public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15865] New: Invalid variable definition through the constructor name
@ 2004-06-08  2:11 giovannibajo at libero dot it
  2004-06-08  2:29 ` [Bug c++/15865] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: giovannibajo at libero dot it @ 2004-06-08  2:11 UTC (permalink / raw)
  To: gcc-bugs

The following code should be rejected but it is not:

----------------------------------
struct A {};
A::A a;
----------------------------------

and the same applies for the template case:

----------------------------------
template <int dim> struct X {};
X<0>::X<0> x;
----------------------------------

-- 
           Summary: Invalid variable definition through the constructor name
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: giovannibajo at libero dot it
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/15865] Invalid variable definition through the constructor name
  2004-06-08  2:11 [Bug c++/15865] New: Invalid variable definition through the constructor name giovannibajo at libero dot it
@ 2004-06-08  2:29 ` pinskia at gcc dot gnu dot org
  2004-06-29 17:20 ` giovannibajo at libero dot it
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-08  2:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-08 02:29 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-06-08 02:29:31
               date|                            |


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


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

* [Bug c++/15865] Invalid variable definition through the constructor name
  2004-06-08  2:11 [Bug c++/15865] New: Invalid variable definition through the constructor name giovannibajo at libero dot it
  2004-06-08  2:29 ` [Bug c++/15865] " pinskia at gcc dot gnu dot org
@ 2004-06-29 17:20 ` giovannibajo at libero dot it
  2004-08-17 17:11 ` reichelt at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: giovannibajo at libero dot it @ 2004-06-29 17:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-06-29 17:15 -------
*** Bug 7433 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |akim at epita dot fr


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


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

* [Bug c++/15865] Invalid variable definition through the constructor name
  2004-06-08  2:11 [Bug c++/15865] New: Invalid variable definition through the constructor name giovannibajo at libero dot it
  2004-06-08  2:29 ` [Bug c++/15865] " pinskia at gcc dot gnu dot org
  2004-06-29 17:20 ` giovannibajo at libero dot it
@ 2004-08-17 17:11 ` reichelt at gcc dot gnu dot org
  2004-08-27  1:09 ` giovannibajo at libero dot it
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-08-17 17:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-08-17 17:11 -------
This is in fact valid code.

*** This bug has been marked as a duplicate of 11487 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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


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

* [Bug c++/15865] Invalid variable definition through the constructor name
  2004-06-08  2:11 [Bug c++/15865] New: Invalid variable definition through the constructor name giovannibajo at libero dot it
                   ` (2 preceding siblings ...)
  2004-08-17 17:11 ` reichelt at gcc dot gnu dot org
@ 2004-08-27  1:09 ` giovannibajo at libero dot it
  2004-08-27  1:11 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: giovannibajo at libero dot it @ 2004-08-27  1:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-08-27 01:09 -------
You'll have to explain me why, though, Volker. Can you cite me the right 
paragraph in the standard? I don't have one handy right now but I'm pretty sure 
I checked before filing this bug (too bad I didn't quote it at the time).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/15865] Invalid variable definition through the constructor name
  2004-06-08  2:11 [Bug c++/15865] New: Invalid variable definition through the constructor name giovannibajo at libero dot it
                   ` (3 preceding siblings ...)
  2004-08-27  1:09 ` giovannibajo at libero dot it
@ 2004-08-27  1:11 ` pinskia at gcc dot gnu dot org
  2004-08-27  1:21 ` [Bug c++/15865] [DR 147] " giovannibajo at libero dot it
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-27  1:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-27 01:11 -------
I think you should look at the dup bug which gives the reference to the standard:
[3.4/3 says 'because the name of a class is inserted in its class scope, the
name of the class is also considered a member of the class for the purposes of
name hiding and lookup.

-- 


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


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

* [Bug c++/15865] [DR 147] Invalid variable definition through the constructor name
  2004-06-08  2:11 [Bug c++/15865] New: Invalid variable definition through the constructor name giovannibajo at libero dot it
                   ` (4 preceding siblings ...)
  2004-08-27  1:11 ` pinskia at gcc dot gnu dot org
@ 2004-08-27  1:21 ` giovannibajo at libero dot it
  2004-08-27  1:23 ` giovannibajo at libero dot it
  2004-08-27  1:52 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: giovannibajo at libero dot it @ 2004-08-27  1:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-08-27 01:21 -------
That is misleading, DR 147 clarifies this. It adds this paragraph to 
[class.qual]:


  If  the  nested-name-specifier  nominates  a  class  C,  and  the name
  specified after the nested-name-specifier, when looked up in C, is the
  injected-class-name  of  C  (clause  _class_),  the  name  is  instead
  considered to name the constructor of class  C.   Such  a  constructor
  name  shall  be  used  only  in  the  declarator-id  of  a constructor
  definition that appears outside of the class definition.  [Example:

     struct A { A(); };
     struct B: public A { B(); };

     A::A() { }
     B::B() { }

     B::A ba;                        // object of type A
     A::A a;                         // error, A::A is not a type name

   --end example]

See also testsuite/g++.dg/tc1/dr147.C (xfailed).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |
            Summary|Invalid variable definition |[DR 147] Invalid variable
                   |through the constructor name|definition through the
                   |                            |constructor name


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


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

* [Bug c++/15865] [DR 147] Invalid variable definition through the constructor name
  2004-06-08  2:11 [Bug c++/15865] New: Invalid variable definition through the constructor name giovannibajo at libero dot it
                   ` (5 preceding siblings ...)
  2004-08-27  1:21 ` [Bug c++/15865] [DR 147] " giovannibajo at libero dot it
@ 2004-08-27  1:23 ` giovannibajo at libero dot it
  2004-08-27  1:52 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: giovannibajo at libero dot it @ 2004-08-27  1:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-08-27 01:23 -------
Also, notice DR 318 with WP status that says that "struct A::A" is instead 
valid to define an object of type A.

-- 


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


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

* [Bug c++/15865] [DR 147] Invalid variable definition through the constructor name
  2004-06-08  2:11 [Bug c++/15865] New: Invalid variable definition through the constructor name giovannibajo at libero dot it
                   ` (6 preceding siblings ...)
  2004-08-27  1:23 ` giovannibajo at libero dot it
@ 2004-08-27  1:52 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-27  1:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-27 01:52 -------
But we already have another PR about DR 147, see PR 11764.

*** This bug has been marked as a duplicate of 11764 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2004-08-27  1:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-08  2:11 [Bug c++/15865] New: Invalid variable definition through the constructor name giovannibajo at libero dot it
2004-06-08  2:29 ` [Bug c++/15865] " pinskia at gcc dot gnu dot org
2004-06-29 17:20 ` giovannibajo at libero dot it
2004-08-17 17:11 ` reichelt at gcc dot gnu dot org
2004-08-27  1:09 ` giovannibajo at libero dot it
2004-08-27  1:11 ` pinskia at gcc dot gnu dot org
2004-08-27  1:21 ` [Bug c++/15865] [DR 147] " giovannibajo at libero dot it
2004-08-27  1:23 ` giovannibajo at libero dot it
2004-08-27  1:52 ` pinskia at gcc dot gnu dot 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).