public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/45139]  New: constructor call with a single variable as the argument is interpreted as a variable declaration if it's a full expression.
@ 2010-07-30  8:25 jsdeckerido at gmail dot com
  2010-07-30  9:32 ` [Bug c++/45139] " paolo dot carlini at oracle dot com
  0 siblings, 1 reply; 2+ messages in thread
From: jsdeckerido at gmail dot com @ 2010-07-30  8:25 UTC (permalink / raw)
  To: gcc-bugs

Hopefully this isn't standard defined behavior, because it doesn't make much
sense.

// trying to have some overloaded functions to share some private data:

class A {
private:
    // some static stuff
    // ...

public:
    A(int a, int b = 0) {}
    // more versions of A(...)
    // ...
};

int main() {
    int a = 0;

    A(a, 0); // works
    A(a); // error: attempting to redeclare a
    (A(a)); // this works
}


-- 
           Summary: constructor call with a single variable as the argument
                    is interpreted as a variable declaration if it's a full
                    expression.
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jsdeckerido at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45139


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

* [Bug c++/45139] constructor call with a single variable as the argument is interpreted as a variable declaration if it's a full expression.
  2010-07-30  8:25 [Bug c++/45139] New: constructor call with a single variable as the argument is interpreted as a variable declaration if it's a full expression jsdeckerido at gmail dot com
@ 2010-07-30  9:32 ` paolo dot carlini at oracle dot com
  0 siblings, 0 replies; 2+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-07-30  9:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from paolo dot carlini at oracle dot com  2010-07-30 09:32 -------
It is, and it's well known.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45139


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

end of thread, other threads:[~2010-07-30  9:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-30  8:25 [Bug c++/45139] New: constructor call with a single variable as the argument is interpreted as a variable declaration if it's a full expression jsdeckerido at gmail dot com
2010-07-30  9:32 ` [Bug c++/45139] " paolo dot carlini at oracle dot com

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).