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

            Bug ID: 85054
           Summary: gcc8 fail to identify template redeclaration - problem
                    in string header
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mib.bugzilla at gmail dot com
  Target Milestone: ---

The Intel compiler and clang compiler finds an error in gcc8 string header [now
fixed] which gcc didn't find.  I opened a bug report at llvm and Richard Smith
provided this analysis of the issue: 
This is CWG issue 1980 (wg21.link/cwg1980, which is still open at the time of
writing).


Further reduced and cleaned up:

template<typename ... > using void_t = void;
template<typename, typename> struct X;
template<typename T> struct X<T, void_t<typename T::type>> {};
template<typename T> struct X<T, void> {};

Same question as applied to function template overloads:

template<typename T> void f(X<T, void_t<typename T::type>>) {}
template<typename T> void f(X<T, void>) {}


[temp.alias]p2 says:

"When a template-id refers to the specialization of an alias template, it is
equivalent to the associated type obtained by substitution of its
template-arguments for the template-parameters in the type-id of the alias
template."

Now, "equivalent" here means equivalent in the [temp.over.link] sense -- in
particular, it is intended that you can redeclare function templates with and
without manually expanding alias templates that they name. Which means the two
function templates, and the two partial specializations, are equivalent (but,
oddly, not functionally-equivalent).

Since they're equivalent, they're redeclarations, at least in today's standard
wording.

https://bugs.llvm.org/show_bug.cgi?id=36869

--Melanie Blower (I work for Intel on the Intel C++ compiler)

Reply via email to