[Bug c++/85457] New: enum and auto template parameter mixup

info at thinkmeta dot de gcc-bugzilla@gcc.gnu.org
Wed Apr 18 20:04:00 GMT 2018


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

            Bug ID: 85457
           Summary: enum and auto template parameter mixup
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: info at thinkmeta dot de
  Target Milestone: ---

enum class X { Y = 0 };

template <auto>
struct D {};

template <class _T, class _D>
struct Y;

template <class _T, _T _Value>
struct Y<_T, D<_Value>> {};

void test() {
    Y<X, D<X::Y>> y1;
    Y<int, D<0>> y2; // compile error
    Y<int, D<1>> y3; // works
}

For integer values 'auto' is deduced to 'X' if a member with the same value
(here 'Y') was used in an instantiation of 'D'.


More information about the Gcc-bugs mailing list