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

* [Bug c++/115377] Invalid typename with non nested-name-specifier accepted in specific contexts
  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 ` 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
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-06 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>    typename V=42;

It is treating it as int.

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

* [Bug c++/115377] [11/12/13/14/15 Regression] Invalid typename with non nested-name-specifier accepted in specific contexts
  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 ` 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
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-06 21:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.8.5, 4.9.4
   Target Milestone|---                         |11.5
   Last reconfirmed|                            |2024-06-06
             Status|UNCONFIRMED                 |NEW
            Summary|Invalid typename with non   |[11/12/13/14/15 Regression]
                   |nested-name-specifier       |Invalid typename with non
                   |accepted in specific        |nested-name-specifier
                   |contexts                    |accepted in specific
                   |                            |contexts
      Known to fail|                            |5.1.0
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/115377] [11/12/13/14/15 Regression] Invalid typename with non nested-name-specifier accepted in specific contexts since r5-2683
  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 ` jakub at gcc dot gnu.org
  2024-06-17 19:32 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-06-17 11:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
            Summary|[11/12/13/14/15 Regression] |[11/12/13/14/15 Regression]
                   |Invalid typename with non   |Invalid typename with non
                   |nested-name-specifier       |nested-name-specifier
                   |accepted in specific        |accepted in specific
                   |contexts                    |contexts since r5-2683

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is accepted since r5-2683-g215acd2bae70e5ae9cbe68bdaa150a9215722310

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

* [Bug c++/115377] [11/12/13/14/15 Regression] Invalid typename with non nested-name-specifier accepted in specific contexts since r5-2683
  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
                   ` (2 preceding siblings ...)
  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
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-06-17 19:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Patch thread: https://gcc.gnu.org/pipermail/gcc-patches/2014-August/395789.html

The patch doesn't seem to match what was actually committed?

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