Issue 156145
Summary [clang][temp.explicit] Explicit template instantiation leads to incorrect checking of constraints
Labels clang
Assignees
Reporter ddvamp
    Clang trunk (godbolt.org)

template <typename T>
struct S {
  void foo() requires (sizeof(T) == 1); // declaration
};

struct I;

template struct S<I>; // explicit
S<I> s;

struct I {};

template <typename T>
void S<T>::foo() requires (sizeof(T) == 1) { // definition
 static_assert(sizeof(T) == 2);
}

void fn() {
    S<I>{}.foo(); // CE: constraints not satisfied (ill-formed, incomplete type)
}

It looks like the constraints are checked at the point of declaration, not definition. Correct me please if this behavior is determined by the standard
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to