Closed
Description
Repro (3rd version, 2nd version reproduced other possible bug; see edit history):
template<class X>
constexpr X failure() {
return nullptr;
}
struct T {
template<class X>
requires false
constexpr explicit(failure<X>()) T(X) { }
T(int) { }
};
static T t(5);
Expected: correct compilation
Got:
<source>:3:12: error: cannot initialize return object of type 'int' with an rvalue of type 'std::nullptr_t'
return nullptr;
^~~~~~~
<source>:9:24: note: in instantiation of function template specialization 'failure<int>' requested here
constexpr explicit(failure<X>()) T(X) { }
^
<source>:14:10: note: while substituting deduced template arguments into function template 'T' [with X = int]
static T t(5);
^
Compiler explorer: https://godbolt.org/z/sPsGh46Gs
Discovered in: microsoft/STL#3323
Metadata
Metadata
Assignees
Type
Projects
Status
Done