[Bug c++/19503] New: Parsing problem in the constructor call of temporary object
timo dot erkkila at tut dot fi
gcc-bugzilla@gcc.gnu.org
Tue Jan 18 12:26:00 GMT 2005
Hello,
the following code
struct A { };
struct B { B( A& ) { } };
void foo( A& a ) { B( a ); }
results in this output:
g++ t.cc -c
t.cc: In function `void foo(A&)':
t.cc:4: error: declaration of 'B a' shadows a parameter
t.cc:4: error: no matching function for call to `B::B()'
t.cc:2: note: candidates are: B::B(const B&)
t.cc:2: note: B::B(A&)
With a workaround (extra cast) in foo, it however compiles ok:
void foo( A& a ) { B( (A&)a ); }
Yours,
Timo Erkkilä
Ps. g++ -v
Reading specs from
/share/local/lang/gcc342-sol7/bin/../lib/gcc/sparc-sun-solaris2.7/3.4.2/specs
Configured with: ../../gcc-3.4.2/configure --prefix=/opt/local/lang/gcc342-sol7
--enable-shared --enable-cpp --disable-threads --with-gnu-ld
--with-ld=/opt/local/lang/gcc342-sol7/bin/ld --with-gnu-as
--with-as=/opt/local/lang/gcc342-sol7/bin/as --with-cpu=supersparc --disable-nls
--disable-multilib --enable-c99 --enable-concept-checks --with-dwarf2
--enable-languages=c,c++
Thread model: single
gcc version 3.4.2
--
Summary: Parsing problem in the constructor call of temporary
object
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: timo dot erkkila at tut dot fi
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: sparc-sun-solaris2.7
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19503
More information about the Gcc-bugs
mailing list