https://bugs.llvm.org/show_bug.cgi?id=49513
Bug ID: 49513
Summary: Invalid type in constraint substitution results in
hard error instead of substitution failure
Product: clang
Version: 11.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
>From StackOverflow (https://stackoverflow.com/q/66562184/2069064):
template<class T>
struct A {
constexpr bool operator()() requires T::value { return T::value; }
constexpr bool operator()() { return false; }
};
static_assert(!A<void>()());
clang rejects this, saying:
<source>:3:42: error: type 'void' cannot be used prior to '::' because it has
no members
constexpr bool operator()() requires T::value { return T::value; }
^
<source>:7:16: note: in instantiation of template class 'A<void>' requested
here
static_assert(!A<void>()());
^
But the rule in [temp.constr.atomic] is that "if substitution results in an
invalid type or expression, the constraint is not satisfied." Which is what
should happen here. gcc and msvc accept.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs