public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115377] New: Invalid typename with non nested-name-specifier accepted in specific contexts
@ 2024-06-06 20:54 luigighiron at gmail dot com
  2024-06-06 20:59 ` [Bug c++/115377] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: luigighiron at gmail dot com @ 2024-06-06 20:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115377
           Summary: Invalid typename with non nested-name-specifier
                    accepted in specific contexts
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luigighiron at gmail dot com
  Target Milestone: ---

GCC will accept some invalid uses of typename, for example:

#include<iostream>
using V=int;
int main(){
    typename V=42;
    std::cout<<V<<'\n';
}

Here, it seems like GCC is interpreting the V as being both the type of the
thing declared and the thing that is being declared. Note that trying to give a
different name e.g. typename V v=42; causes GCC to give an error about
expecting a nested-name-specifier. Here are some more examples to demonstrate
the bug:

#include<iostream>
using V=int;
int main(){
    typename const V[2]=std::cout;
    typename(*V)[V?V,V:V](V){nullptr};
    typename random[main];
}

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

end of thread, other threads:[~2024-06-17 19:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-06 20:54 [Bug c++/115377] New: Invalid typename with non nested-name-specifier accepted in specific contexts luigighiron at gmail dot com
2024-06-06 20:59 ` [Bug c++/115377] " pinskia at gcc dot gnu.org
2024-06-06 21:04 ` [Bug c++/115377] [11/12/13/14/15 Regression] " pinskia at gcc dot gnu.org
2024-06-17 11:29 ` [Bug c++/115377] [11/12/13/14/15 Regression] Invalid typename with non nested-name-specifier accepted in specific contexts since r5-2683 jakub at gcc dot gnu.org
2024-06-17 19:32 ` mpolacek 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).