public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114491] New: incorrect identifier namespacing with variadic templates
@ 2024-03-27  0:20 christoph.schied at gmail dot com
  2024-03-27  0:25 ` [Bug c++/114491] " pinskia at gcc dot gnu.org
  2024-03-27  0:26 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: christoph.schied at gmail dot com @ 2024-03-27  0:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114491
           Summary: incorrect identifier namespacing with variadic
                    templates
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: christoph.schied at gmail dot com
  Target Milestone: ---

Created attachment 57818
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57818&action=edit
same source code as posted in the description

The following code fails to compile with g++, however it works with clang. I
tried various versions of gcc in godbolt (https://godbolt.org/z/xqfoc4Yce)
using std=c++17 and std=c++20 and the code fails to compile on all versions. It
appears that the dependent type T gets confused with the template argument of
the function.

template<typename A, typename... X>
void works()
{
    typename A::T var;
}

template<typename A, typename... T>
void broken()
{
    typename A::T var; /* A::T and T seem to clash */
}


results in:
<source>: In function 'void broken()':
<source>:10:19: error: parameter packs not expanded with '...':
   10 |     typename A::T var; /* A::T and T seem to clash */
      |                   ^~~
<source>:10:19: note:         'T'

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

* [Bug c++/114491] incorrect identifier namespacing with variadic templates
  2024-03-27  0:20 [Bug c++/114491] New: incorrect identifier namespacing with variadic templates christoph.schied at gmail dot com
@ 2024-03-27  0:25 ` pinskia at gcc dot gnu.org
  2024-03-27  0:26 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-27  0:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-03-27

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

Interesting:
```
template<typename A, auto... T>
void works_also()
{
    typename A::T var; /* A::T and T seem to clash */
}
```

Works also.

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

* [Bug c++/114491] incorrect identifier namespacing with variadic templates
  2024-03-27  0:20 [Bug c++/114491] New: incorrect identifier namespacing with variadic templates christoph.schied at gmail dot com
  2024-03-27  0:25 ` [Bug c++/114491] " pinskia at gcc dot gnu.org
@ 2024-03-27  0:26 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-27  0:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Oh but it is a duplicate.

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

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

end of thread, other threads:[~2024-03-27  0:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27  0:20 [Bug c++/114491] New: incorrect identifier namespacing with variadic templates christoph.schied at gmail dot com
2024-03-27  0:25 ` [Bug c++/114491] " pinskia at gcc dot gnu.org
2024-03-27  0:26 ` 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).