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'

Reply via email to