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

            Bug ID: 124457
           Summary: spurious reflection cannot be applied to a placeholder
                    type error in constrained return types
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

Slightly reduced example from Walter Brown:

template <class T, auto t = ^^T>
concept True = true;

template <class T>
concept AlsoTrue = requires (T t) {
    { t } -> True;
};

This fails with:

<source>:1:31: error: '^^' cannot be applied to a placeholder type
    1 | template <class T, auto t = ^^T>
      |                               ^
<source>:6:14: error: template argument 2 is invalid
    6 |     { t } -> True;
      |              ^~~~


I think this should actually work. Doing static_assert(True<int>) does succeed.
Of the other uses of type-constraint syntax:

void f1(True auto x);            // ok
template <True T> void f2(T );   // ok
auto f3(int) -> True auto;       // error

Reply via email to