Open Eczbek opened 1 week ago
https://godbolt.org/z/Yfsdrnn4E
struct foo { foo(const foo&) = default; foo(auto) requires([]<int = 0> -> bool { return true; }()) {} }; struct bar { foo x; }; int main() {}
<source>:4:21: error: substitution into constraint expression resulted in a non-constant expression 4 | foo(auto) requires([]<int = 0> -> bool { return true; }()) {} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>:1:8: note: while checking constraint satisfaction for template 'foo<foo>' required here 1 | struct foo { | ^~~ <source>:1:8: note: in instantiation of function template specialization 'foo::foo<foo>' requested here <source>:7:8: note: while declaring the implicit copy constructor for 'bar' 7 | struct bar { foo x; }; | ^ <source>:4:21: note: undefined function 'operator()<0>' cannot be used in a constant expression 4 | foo(auto) requires([]<int = 0> -> bool { return true; }()) {} | ^ <source>:4:21: note: declared here <source>:4:21: error: substitution into constraint expression resulted in a non-constant expression 4 | foo(auto) requires([]<int = 0> -> bool { return true; }()) {} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>:1:8: note: while checking constraint satisfaction for template 'foo<foo>' required here 1 | struct foo { | ^~~ <source>:1:8: note: while substituting deduced template arguments into function template 'foo' [with auto:1 = foo] <source>:7:8: note: while declaring the implicit move constructor for 'bar' 7 | struct bar { foo x; }; | ^ <source>:4:21: note: undefined function 'operator()<0>' cannot be used in a constant expression 4 | foo(auto) requires([]<int = 0> -> bool { return true; }()) {} | ^ <source>:4:21: note: declared here 2 errors generated. Compiler returned: 1
This compiles just fine if I remove -> bool: https://godbolt.org/z/aqGjcrd35
-> bool
@llvm/issue-subscribers-clang-frontend
Author: None (Eczbek)
https://godbolt.org/z/Yfsdrnn4E