public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
@ 2006-07-01  1:06 ` fang at csl dot cornell dot edu
  2006-07-01 11:18 ` steven at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: fang at csl dot cornell dot edu @ 2006-07-01  1:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fang at csl dot cornell dot edu  2006-07-01 01:06 -------
Tripped over this bug while testing some code against ICPC... almost filed a
dupe!  
Using the test case from PR 23385, still reproducible (accepts-invalid) on
mainline g++ 4.2.0-20060610.

I'd like to understand the rationale behind this C++ standard clause...  


-- 


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


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

* [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
  2006-07-01  1:06 ` [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced fang at csl dot cornell dot edu
@ 2006-07-01 11:18 ` steven at gcc dot gnu dot org
  2006-07-01 22:09 ` mmitchel at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: steven at gcc dot gnu dot org @ 2006-07-01 11:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from steven at gcc dot gnu dot org  2006-07-01 11:18 -------
Mark, this bug concerns a C++ standard question, perhaps you could give your
interpretation...


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at codesourcery dot com
   Last reconfirmed|2005-11-04 04:36:06         |2006-07-01 11:18:03
               date|                            |


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


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

* [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
  2006-07-01  1:06 ` [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced fang at csl dot cornell dot edu
  2006-07-01 11:18 ` steven at gcc dot gnu dot org
@ 2006-07-01 22:09 ` mmitchel at gcc dot gnu dot org
  2006-07-02  8:44 ` truedfx at gentoo dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-07-01 22:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mmitchel at gcc dot gnu dot org  2006-07-01 22:09 -------
This code is not invalid, and G++ is correct to accept it.

DR68 permits this grammatical production and typedef-names for classes are
class-names.


-- 

mmitchel at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-07-01 22:09 ` mmitchel at gcc dot gnu dot org
@ 2006-07-02  8:44 ` truedfx at gentoo dot org
  2006-07-02 17:37 ` fang at csl dot cornell dot edu
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: truedfx at gentoo dot org @ 2006-07-02  8:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from truedfx at gentoo dot org  2006-07-02 08:44 -------
> This code is not invalid, and G++ is correct to accept it.
> 
> DR68 permits this grammatical production and typedef-names for classes are
> class-names.

Does that mean this code is valid, too?

typedef class A {} a;
class B {
    friend class a;
};

GCC 4.1.1 rejects it with error: using typedef-name &#8216;a&#8217; after
&#8216;class&#8217;.

And if it is valid, should a new bug be opened for it?


-- 


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


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

* [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2006-07-02  8:44 ` truedfx at gentoo dot org
@ 2006-07-02 17:37 ` fang at csl dot cornell dot edu
  2006-07-03  5:19 ` mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: fang at csl dot cornell dot edu @ 2006-07-02 17:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from fang at csl dot cornell dot edu  2006-07-02 17:37 -------
Subject: Re:  clause 7.1.5.3/2 of the c++ is not enforced

Would it be appropriate to prefix [DR 68] to the subject?


-- 


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


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

* [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2006-07-02 17:37 ` fang at csl dot cornell dot edu
@ 2006-07-03  5:19 ` mmitchel at gcc dot gnu dot org
  2006-09-05 10:21 ` pluto at agmk dot net
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-07-03  5:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from mmitchel at gcc dot gnu dot org  2006-07-03 05:19 -------
I'm sorry; I had missed the fact that the elaborated type specifier refers uses
a typedef-name.  This code is in fact invalid, since an elaborated type
specifier may not refer to a typedef-name.


-- 

mmitchel at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2006-07-03  5:19 ` mmitchel at gcc dot gnu dot org
@ 2006-09-05 10:21 ` pluto at agmk dot net
  2006-09-18 23:42 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: pluto at agmk dot net @ 2006-09-05 10:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pluto at agmk dot net  2006-09-05 10:20 -------
*** Bug 28895 has been marked as a duplicate of this bug. ***


-- 

pluto at agmk dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


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


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

* [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2006-09-18 23:42 ` pinskia at gcc dot gnu dot org
@ 2006-09-18 23:42 ` pinskia at gcc dot gnu dot org
  2006-09-18 23:43 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-18 23:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2006-09-18 23:42 -------
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1520.pdf
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf 


-- 


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


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

* [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2006-09-05 10:21 ` pluto at agmk dot net
@ 2006-09-18 23:42 ` pinskia at gcc dot gnu dot org
  2006-09-18 23:42 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-18 23:42 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW


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


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

* [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2006-09-18 23:42 ` pinskia at gcc dot gnu dot org
@ 2006-09-18 23:43 ` pinskia at gcc dot gnu dot org
  2006-09-18 23:43 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-18 23:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pinskia at gcc dot gnu dot org  2006-09-18 23:42 -------
*** Bug 22047 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kumar dot mahesh at
                   |                            |cognizant dot com


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


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

* [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2006-09-18 23:43 ` pinskia at gcc dot gnu dot org
@ 2006-09-18 23:43 ` pinskia at gcc dot gnu dot org
  2006-09-18 23:44 ` [Bug c++/21498] [c++0x] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-18 23:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from pinskia at gcc dot gnu dot org  2006-09-18 23:42 -------
*** Bug 29123 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcc at pdoerfler dot com


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


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

* [Bug c++/21498] [c++0x] clause 7.1.5.3/2 of the c++ is not enforced
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2006-09-18 23:43 ` pinskia at gcc dot gnu dot org
@ 2006-09-18 23:44 ` pinskia at gcc dot gnu dot org
  2006-09-19  5:18 ` pinskia at gcc dot gnu dot org
  2009-11-03 18:40 ` [Bug c++/21498] [c++0x] friend declaration can name non-class with class-key jason at gcc dot gnu dot org
  13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-18 23:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from pinskia at gcc dot gnu dot org  2006-09-18 23:42 -------
*** Bug 29123 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcc at pdoerfler dot com
            Summary|clause 7.1.5.3/2 of the c++ |[c++0x] clause 7.1.5.3/2 of
                   |is not enforced             |the c++ is not enforced


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


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

* [Bug c++/21498] [c++0x] clause 7.1.5.3/2 of the c++ is not enforced
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2006-09-18 23:44 ` [Bug c++/21498] [c++0x] " pinskia at gcc dot gnu dot org
@ 2006-09-19  5:18 ` pinskia at gcc dot gnu dot org
  2009-11-03 18:40 ` [Bug c++/21498] [c++0x] friend declaration can name non-class with class-key jason at gcc dot gnu dot org
  13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-19  5:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from pinskia at gcc dot gnu dot org  2006-09-19 05:18 -------
I don't know the state of this feature in C++0x at all and I don't know if this
means this is now valid code but only with an option like -std=c++0x.


-- 


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


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

* [Bug c++/21498] [c++0x] friend declaration can name non-class with class-key
       [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
                   ` (12 preceding siblings ...)
  2006-09-19  5:18 ` pinskia at gcc dot gnu dot org
@ 2009-11-03 18:40 ` jason at gcc dot gnu dot org
  13 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-03 18:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from jason at gcc dot gnu dot org  2009-11-03 18:40 -------
In C++0x the testcase is still ill-formed, but changing "friend class" to
"friend typename" makes it well-formed.  I'm not going to give an error for
this usage until the other usage is implemented.

http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1791.pdf


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[c++0x] clause 7.1.5.3/2 of |[c++0x] friend declaration
                   |the c++ is not enforced     |can name non-class with
                   |                            |class-key


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


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

* [Bug c++/21498] [c++0x] friend declaration can name non-class with class-key
       [not found] <bug-21498-4@http.gcc.gnu.org/bugzilla/>
  2011-09-10  3:30 ` redi at gcc dot gnu.org
@ 2024-02-07  9:27 ` jlame646 at gmail dot com
  1 sibling, 0 replies; 16+ messages in thread
From: jlame646 at gmail dot com @ 2024-02-07  9:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21498

Jason Liam <jlame646 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jlame646 at gmail dot com

--- Comment #16 from Jason Liam <jlame646 at gmail dot com> ---
GCC still accepts the code when it is ill-formed as explained
here:https://stackoverflow.com/questions/77932976/why-is-a-type-alias-not-allowed-to-be-a-friend-class-name-in-c/77932987#77932987

Here is a demo that shows that gcc accepts the invalid code:
https://godbolt.org/z/sK8Trh5PG

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

* [Bug c++/21498] [c++0x] friend declaration can name non-class with class-key
       [not found] <bug-21498-4@http.gcc.gnu.org/bugzilla/>
@ 2011-09-10  3:30 ` redi at gcc dot gnu.org
  2024-02-07  9:27 ` jlame646 at gmail dot com
  1 sibling, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-10  3:30 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |

--- Comment #15 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-10 00:03:36 UTC ---
(In reply to comment #14)
> In C++0x the testcase is still ill-formed, but changing "friend class" to
> "friend typename" makes it well-formed.  I'm not going to give an error for
> this usage until the other usage is implemented.
> 
> http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1791.pdf

... which you did for PR 47721 :)


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

end of thread, other threads:[~2024-02-07  9:27 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
2006-07-01  1:06 ` [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced fang at csl dot cornell dot edu
2006-07-01 11:18 ` steven at gcc dot gnu dot org
2006-07-01 22:09 ` mmitchel at gcc dot gnu dot org
2006-07-02  8:44 ` truedfx at gentoo dot org
2006-07-02 17:37 ` fang at csl dot cornell dot edu
2006-07-03  5:19 ` mmitchel at gcc dot gnu dot org
2006-09-05 10:21 ` pluto at agmk dot net
2006-09-18 23:42 ` pinskia at gcc dot gnu dot org
2006-09-18 23:42 ` pinskia at gcc dot gnu dot org
2006-09-18 23:43 ` pinskia at gcc dot gnu dot org
2006-09-18 23:43 ` pinskia at gcc dot gnu dot org
2006-09-18 23:44 ` [Bug c++/21498] [c++0x] " pinskia at gcc dot gnu dot org
2006-09-19  5:18 ` pinskia at gcc dot gnu dot org
2009-11-03 18:40 ` [Bug c++/21498] [c++0x] friend declaration can name non-class with class-key jason at gcc dot gnu dot org
     [not found] <bug-21498-4@http.gcc.gnu.org/bugzilla/>
2011-09-10  3:30 ` redi at gcc dot gnu.org
2024-02-07  9:27 ` jlame646 at gmail 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).