public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/49692] New: Constructor call mistaken for declaration @ 2011-07-09 21:10 kortink at inter dot nl.net 2011-07-09 21:39 ` [Bug c++/49692] " schwab@linux-m68k.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: kortink at inter dot nl.net @ 2011-07-09 21:10 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49692 Summary: Constructor call mistaken for declaration Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: kortink@inter.nl.net The compiler interprets MyObject(variable_name) as MyObject variable_name If variable_name exists as an int, this causes a 'redeclaration' error instead of a call to the constructor MyObject::MyObject(int). Am I missing some syntactic aspect here ? The root cause may very well be that e.g. int (variable_name) is accepted by the compiler as a declaration. It doesn't look like one to me. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/49692] Constructor call mistaken for declaration 2011-07-09 21:10 [Bug c++/49692] New: Constructor call mistaken for declaration kortink at inter dot nl.net @ 2011-07-09 21:39 ` schwab@linux-m68k.org 2011-07-09 23:08 ` kortink at inter dot nl.net 2011-07-10 4:30 ` redi at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: schwab@linux-m68k.org @ 2011-07-09 21:39 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49692 Andreas Schwab <schwab@linux-m68k.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID --- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> 2011-07-09 21:39:28 UTC --- Redundant parens are always possible. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/49692] Constructor call mistaken for declaration 2011-07-09 21:10 [Bug c++/49692] New: Constructor call mistaken for declaration kortink at inter dot nl.net 2011-07-09 21:39 ` [Bug c++/49692] " schwab@linux-m68k.org @ 2011-07-09 23:08 ` kortink at inter dot nl.net 2011-07-10 4:30 ` redi at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: kortink at inter dot nl.net @ 2011-07-09 23:08 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49692 --- Comment #2 from John Kortink <kortink at inter dot nl.net> 2011-07-09 23:08:02 UTC --- (In reply to comment #1) > Redundant parens are always possible. They shouldn't always be possible. It is a laxity in the grammar that needlessly causes context dependencies. And, in this case, rejection of a perfectly valid language construct. Even if the context dependency is not removed, the interpretation of 'classname (variablename)' as a constructor call should be considered by the parser. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/49692] Constructor call mistaken for declaration 2011-07-09 21:10 [Bug c++/49692] New: Constructor call mistaken for declaration kortink at inter dot nl.net 2011-07-09 21:39 ` [Bug c++/49692] " schwab@linux-m68k.org 2011-07-09 23:08 ` kortink at inter dot nl.net @ 2011-07-10 4:30 ` redi at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: redi at gcc dot gnu.org @ 2011-07-10 4:30 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49692 --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-07-10 04:28:04 UTC --- http://en.wikipedia.org/wiki/Most_vexing_parse ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-07-10 4:30 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-07-09 21:10 [Bug c++/49692] New: Constructor call mistaken for declaration kortink at inter dot nl.net 2011-07-09 21:39 ` [Bug c++/49692] " schwab@linux-m68k.org 2011-07-09 23:08 ` kortink at inter dot nl.net 2011-07-10 4:30 ` redi at gcc dot gnu.org
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).