public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19503] New: Parsing problem in the constructor call of temporary object
@ 2005-01-18 12:26 timo dot erkkila at tut dot fi
  2005-01-18 13:42 ` [Bug c++/19503] " gdr at integrable-solutions dot net
  2005-01-18 14:04 ` timo dot erkkila at tut dot fi
  0 siblings, 2 replies; 4+ messages in thread
From: timo dot erkkila at tut dot fi @ 2005-01-18 12:26 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1533 bytes --]

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-01-30 12:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-19503-9285@http.gcc.gnu.org/bugzilla/>
2006-01-30 12:59 ` [Bug c++/19503] Parsing problem in the constructor call of temporary object pinskia at gcc dot gnu dot org
2006-01-30 12:59 ` pinskia at gcc dot gnu dot org
2005-01-18 12:26 [Bug c++/19503] New: " timo dot erkkila at tut dot fi
2005-01-18 13:42 ` [Bug c++/19503] " gdr at integrable-solutions dot net
2005-01-18 14:04 ` timo dot erkkila at tut dot fi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).