This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Function resolution bug in g++ ?
- From: Nathan Sidwell <nathan at acm dot org>
- To: Bill Huey <billh at gnuppy dot monkey dot org>
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 16 Jul 2002 13:17:08 +0100
- Subject: Re: Function resolution bug in g++ ?
- References: <20020716113325.GA6075@gnuppy.monkey.org>
- Reply-to: nathan at compsci dot bristol dot ac dot uk
Bill Huey wrote:
>
> Hello,
>
> This looks like a bug, so I'm posting my report here.
>
> I'm getting this nasty error:
>
> /usr/home/billh/javasrc_1_3_scsl/hotspot1.3.1/src/share/vm/memory/markSweep.cpp: In
> static member function `static void MarkSweep::mark_sweep_phase1(jint&, long
> int)':
> /usr/home/billh/javasrc_1_3_scsl/hotspot1.3.1/src/share/vm/memory/markSweep.cpp:573: call
> of overloaded `TraceTime(char[8], bool)' is ambiguous
> /usr/home/billh/javasrc_1_3_scsl/hotspot1.3.1/src/share/vm/runtime/timer.hpp:64: candidates
> are: TraceTime::TraceTime(const char*, elapsedTimer*, long int = v_true,
> long int = v_false)
> /usr/home/billh/javasrc_1_3_scsl/hotspot1.3.1/src/share/vm/runtime/timer.hpp:63:
> TraceTime::TraceTime(const char*, long int = v_true)
> /usr/home/billh/javasrc_1_3_scsl/hotspot1.3.1/src/share/vm/memory/markSweep.cpp: In
> static member function `static void MarkSweep::mark_sweep_phase2()':
>
> from this code:
>
> TraceTime tm("phase 2", (bool) PrintGC && Verbose);
you have
#defined bool long int
that '(bool) PrintGC && Verbose' is parsed as ((long int)PrintGC) && Verbose
and in your case is an integral constant expression of value zero. It
also has type bool (C++'s bool, not your #define).
That argument can undergo
pointer conversion to a null pointer value of type elapsedTimer *
integral promotion to int, followed by integral conversion to long
those conversions are unordered wrt eachother.
When I try it on what I think your doing,
void Foo (char const *, int *);
void Foo (char const *, long);
int main ()
{
Foo ("hello", false);
return 0;
}
I get
nathan@manao:557>/usr/local/egcs/sparc-SunOS-5/bin/g++ -c foo2.cc
foo2.cc: In function `int main()':
foo2.cc:7: call of overloaded `Foo(const char[6], bool)' is ambiguous
foo2.cc:2: candidates are: void Foo(const char*, int*)
foo2.cc:3: void Foo(const char*, long int)
nathan
--
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
The voices in my head told me to say this
nathan@acm.org http://www.cs.bris.ac.uk/~nathan/ nathan@cs.bris.ac.uk