public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48920] New: typename specifier should not ignore non-type names
@ 2011-05-06 22:54 schaub.johannes at googlemail dot com
  2011-05-06 23:56 ` [Bug c++/48920] " schaub.johannes at googlemail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: schaub.johannes at googlemail dot com @ 2011-05-06 22:54 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: typename specifier should not ignore non-type names
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: schaub.johannes@googlemail.com


The following is ill-formed code

    struct A {
      struct B { };
      int B;
    };

    typename A::B a;

GCC accepts it. As a perhaps related issue, the following looks well-formed:

    template<typename T>
    void f(typename T::B) { }

    template<typename T>
    void f(struct T::B) { }

GCC rejects it as a redefinition. The dependent parameter types of both look
different.


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

* [Bug c++/48920] typename specifier should not ignore non-type names
  2011-05-06 22:54 [Bug c++/48920] New: typename specifier should not ignore non-type names schaub.johannes at googlemail dot com
@ 2011-05-06 23:56 ` schaub.johannes at googlemail dot com
  2012-12-26 13:21 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: schaub.johannes at googlemail dot com @ 2011-05-06 23:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Johannes Schaub <schaub.johannes at googlemail dot com> 2011-05-06 23:47:33 UTC ---
(In reply to comment #0)
> […] As a perhaps related issue, the following looks well-formed:
> 
>     template<typename T>
>     void f(typename T::B) { }
> 
>     template<typename T>
>     void f(struct T::B) { }
> 
> GCC rejects it as a redefinition. The dependent parameter types of both look
> different.

The Itanium ABI does not include any way to distinguish these two cases, so I
suspect GCC can do nothing about this. And if one were to include "typename" as
a hint into the mangling, I can see how this quickly can get out of hand.


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

* [Bug c++/48920] typename specifier should not ignore non-type names
  2011-05-06 22:54 [Bug c++/48920] New: typename specifier should not ignore non-type names schaub.johannes at googlemail dot com
  2011-05-06 23:56 ` [Bug c++/48920] " schaub.johannes at googlemail dot com
@ 2012-12-26 13:21 ` redi at gcc dot gnu.org
  2020-03-12 19:27 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-12-26 13:21 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-12-26 13:21:27 UTC ---
For the first testcase [basic.scope.class] says no diagnostic required, doesn't
it?


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

* [Bug c++/48920] typename specifier should not ignore non-type names
  2011-05-06 22:54 [Bug c++/48920] New: typename specifier should not ignore non-type names schaub.johannes at googlemail dot com
  2011-05-06 23:56 ` [Bug c++/48920] " schaub.johannes at googlemail dot com
  2012-12-26 13:21 ` redi at gcc dot gnu.org
@ 2020-03-12 19:27 ` mpolacek at gcc dot gnu.org
  2021-12-08  8:48 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-03-12 19:27 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michele.caini at gmail dot com

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 78286 has been marked as a duplicate of this bug. ***

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

* [Bug c++/48920] typename specifier should not ignore non-type names
  2011-05-06 22:54 [Bug c++/48920] New: typename specifier should not ignore non-type names schaub.johannes at googlemail dot com
                   ` (2 preceding siblings ...)
  2020-03-12 19:27 ` mpolacek at gcc dot gnu.org
@ 2021-12-08  8:48 ` pinskia at gcc dot gnu.org
  2021-12-08  9:40 ` schaub.johannes at googlemail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-08  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, MSVC rejects this for a different reason from clang (and a different
reason from what the report is requesting):
<source>(7): error C2761: 'int A::B': redeclaration of member is not allowed

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

* [Bug c++/48920] typename specifier should not ignore non-type names
  2011-05-06 22:54 [Bug c++/48920] New: typename specifier should not ignore non-type names schaub.johannes at googlemail dot com
                   ` (3 preceding siblings ...)
  2021-12-08  8:48 ` pinskia at gcc dot gnu.org
@ 2021-12-08  9:40 ` schaub.johannes at googlemail dot com
  2021-12-08 16:36 ` pinskia at gcc dot gnu.org
  2021-12-09  2:25 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: schaub.johannes at googlemail dot com @ 2021-12-08  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Johannes Schaub <schaub.johannes at googlemail dot com> ---
Well then you can replace the class with a nameepace, I think, to remove the
class-scope complication. I think GCC would still incorrectly apply typename
lookup.

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

* [Bug c++/48920] typename specifier should not ignore non-type names
  2011-05-06 22:54 [Bug c++/48920] New: typename specifier should not ignore non-type names schaub.johannes at googlemail dot com
                   ` (4 preceding siblings ...)
  2021-12-08  9:40 ` schaub.johannes at googlemail dot com
@ 2021-12-08 16:36 ` pinskia at gcc dot gnu.org
  2021-12-09  2:25 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-08 16:36 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-12-08
             Status|UNCONFIRMED                 |NEW

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed with:
    namespace A {
      struct B { };
      int B;
    };

    typename A::B a;

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

* [Bug c++/48920] typename specifier should not ignore non-type names
  2011-05-06 22:54 [Bug c++/48920] New: typename specifier should not ignore non-type names schaub.johannes at googlemail dot com
                   ` (5 preceding siblings ...)
  2021-12-08 16:36 ` pinskia at gcc dot gnu.org
@ 2021-12-09  2:25 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-09  2:25 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 32066.

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

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

end of thread, other threads:[~2021-12-09  2:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-06 22:54 [Bug c++/48920] New: typename specifier should not ignore non-type names schaub.johannes at googlemail dot com
2011-05-06 23:56 ` [Bug c++/48920] " schaub.johannes at googlemail dot com
2012-12-26 13:21 ` redi at gcc dot gnu.org
2020-03-12 19:27 ` mpolacek at gcc dot gnu.org
2021-12-08  8:48 ` pinskia at gcc dot gnu.org
2021-12-08  9:40 ` schaub.johannes at googlemail dot com
2021-12-08 16:36 ` pinskia at gcc dot gnu.org
2021-12-09  2:25 ` pinskia 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).