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

            Bug ID: 67117
           Summary: [c++-concepts] Constraints ignored on variable
                    template
           Product: gcc
           Version: c++-concepts
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Casey at Carter dot net
  Target Milestone: ---

r226546 fails to compile this TU:

template <class>
  requires false
constexpr bool v = true;

template <class>
constexpr bool f() { return true; }

template <class T>
  requires v<T>
constexpr bool f() { return false; }

static_assert(f<void>());

with error:

~/concept-gcc/bin/g++ -std=gnu++1z foo.cpp -c
foo.cpp:12:1: error: static assertion failed
 static_assert(f<void>());
 ^

It seems the constraints on the variable template are not checked. Indeed this
TU:

template <class>
  requires false
constexpr bool v = true;

static_assert(v<void>);

is accepted without diagnoses.

Reply via email to