Bug ID: 92771
           Summary: [9/10 Regression] Concept won't use default template
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot
          Reporter: redi at gcc dot
                CC: paolo at gcc dot
            Blocks: 67491
  Target Milestone: ---

template<typename P, typename Q, typename Arghhh = void>
concept three = sizeof(P) == sizeof(Q);

template<typename P, typename Q>
concept two = three<P, Q>;
#define three two

template<typename T, typename U>
constexpr auto
foo(const T& t, const U& u)
  if constexpr (three<T, U>)
    return &t == &u;
  return false;

int main()
  return foo(1, 2);

Using -std=gnu++2a this fails to compile: In function 'constexpr auto foo(const T&, const U&)': error: expected 'auto' or 'decltype(auto)' after 'three<T, U>'
   14 |   if constexpr (three<T, U>)
      |                 ^~~~~~~~~~~ error: expected unqualified-id before ')' token
   14 |   if constexpr (three<T, U>)
      |                            ^

Defining WORKAROUND to add the indirection through 'two' fixes it.

This was accepted prior to r260482 (which was fixing PR c++/84588).

Referenced Bugs:
[Bug 67491] [meta-bug] concepts issues

Reply via email to