diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CXX/expr/expr.prim/expr.prim.id/p4.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.id/p4.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.id/p4.cpp index f4c38c73d25..d3dde10ff2b 100644 --- a/clang/test/CXX/expr/expr.prim/expr.prim.id/p4.cpp +++ b/clang/test/CXX/expr/expr.prim/expr.prim.id/p4.cpp @@ -26,11 +26,14 @@ namespace methods struct A { static void foo(int) requires (sizeof(T) == 1) {} // expected-note 3{{because 'sizeof(char [2]) == 1' (2 == 1) evaluated to false}} static void bar(int) requires (sizeof(T) == 2) {} // expected-note 3{{because 'sizeof(char) == 2' (1 == 2) evaluated to false}} + // Make sure the function body is not instantiated before constraints are checked. + static auto baz(int) requires (sizeof(T) == 2) { return T::foo(); } // expected-note{{because 'sizeof(char) == 2' (1 == 2) evaluated to false}} }; void baz() { A<char>::foo(1); A<char>::bar(1); // expected-error{{invalid reference to function 'bar': constraints not satisfied}} + A<char>::baz(1); // expected-error{{invalid reference to function 'baz': constraints not satisfied}} A<char[2]>::foo(1); // expected-error{{invalid reference to function 'foo': constraints not satisfied}} A<char[2]>::bar(1); void (*p1)(int) = A<char>::foo; |