[Bug c++/101174] New: [12 Regression] CTAD causes instantiation of invalid specialization

ppalka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 23 03:41:50 GMT 2021


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

            Bug ID: 101174
           Summary: [12 Regression] CTAD causes instantiation of invalid
                    specialization
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppalka at gcc dot gnu.org
  Target Milestone: ---

The following testcase

struct S { using type = int; };

template<class T = int, class U = S>
struct multiset {
  using type = typename U::type;
  multiset(T);
  multiset(U);
};

template<class T>
multiset(T) -> multiset<T>;

multiset c(42);

is rejected by GCC 12 with

<stdin>: In instantiation of ‘struct multiset<int, int>’:
<stdin>:13:14:   required from here
<stdin>:5:9: error: ‘int’ is not a class, struct, or union type
<stdin>:7:3: error: ‘multiset<T, U>::multiset(U) [with T = int; U = int]’
cannot be overloaded with ‘multiset<T, U>::multiset(T) [with T = int; U = int]’
<stdin>:6:3: note: previous declaration ‘multiset<T, U>::multiset(T) [with T =
int; U = int]’


More information about the Gcc-bugs mailing list