diff options
Diffstat (limited to 'clang/test/SemaCXX')
-rw-r--r-- | clang/test/SemaCXX/alloc-token.cpp | 23 | ||||
-rw-r--r-- | clang/test/SemaCXX/cxx2c-fold-exprs.cpp | 42 |
2 files changed, 37 insertions, 28 deletions
diff --git a/clang/test/SemaCXX/alloc-token.cpp b/clang/test/SemaCXX/alloc-token.cpp new file mode 100644 index 0000000..a267442 --- /dev/null +++ b/clang/test/SemaCXX/alloc-token.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -verify %s -fexperimental-new-constant-interpreter +// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -verify %s -falloc-token-mode=typehash -DMODE_TYPEHASH + +#if !__has_builtin(__builtin_infer_alloc_token) +#error "missing __builtin_infer_alloc_token" +#endif + +template <typename T = void> +void template_test() { + __builtin_infer_alloc_token(T()); // no error if not instantiated +} + +template <typename T> +void negative_template_test() { + __builtin_infer_alloc_token(T()); // expected-error {{argument may not have 'void' type}} +} + +void negative_tests() { + __builtin_infer_alloc_token(); // expected-error {{too few arguments to function call}} + __builtin_infer_alloc_token((void)0); // expected-error {{argument may not have 'void' type}} + negative_template_test<void>(); // expected-note {{in instantiation of function template specialization 'negative_template_test<void>' requested here}} +} diff --git a/clang/test/SemaCXX/cxx2c-fold-exprs.cpp b/clang/test/SemaCXX/cxx2c-fold-exprs.cpp index 137f46e..289059e 100644 --- a/clang/test/SemaCXX/cxx2c-fold-exprs.cpp +++ b/clang/test/SemaCXX/cxx2c-fold-exprs.cpp @@ -157,66 +157,55 @@ static_assert(And1<S, S>() == 1); // FIXME: The diagnostics are not so great static_assert(And1<int>() == 1); // expected-error {{no matching function for call to 'And1'}} // expected-note@#and1 {{candidate template ignored: constraints not satisfied [with T = <int>]}} - // expected-note@#and1 {{because 'typename T::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#and1 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} static_assert(And1<S, int>() == 1); // expected-error {{no matching function for call to 'And1'}} // expected-note@#and1 {{candidate template ignored: constraints not satisfied [with T = <S, int>]}} - // expected-note@#and1 {{because 'typename T::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#and1 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} static_assert(And1<int, S>() == 1); // expected-error {{no matching function for call to 'And1'}} // expected-note@#and1 {{candidate template ignored: constraints not satisfied [with T = <int, S>]}} - // expected-note@#and1 {{because 'typename T::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#and1 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} static_assert(And2<S>() == 2); static_assert(And2<S, S>() == 2); static_assert(And2<int>() == 2); // expected-error {{no matching function for call to 'And2'}} // expected-note@#and2 {{candidate template ignored: constraints not satisfied [with T = int, U = <>]}} - // expected-note@#and2 {{because 'typename U::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#and2 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} static_assert(And2<int, int>() == 2); // expected-error {{no matching function for call to 'And2'}} // expected-note@#and2 {{candidate template ignored: constraints not satisfied [with T = S, U = <int>]}} \ - // expected-note@#and2 {{because 'typename U::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#and2 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} static_assert(And2<S, int>() == 2); // expected-error {{no matching function for call to 'And2'}} // expected-note@#and2 {{candidate template ignored: constraints not satisfied [with T = int, U = <S>]}} - // expected-note@#and2 {{because 'typename T::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#and2 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} static_assert(And2<int, S>() == 2); // expected-error {{no matching function for call to 'And2'}} // expected-note@#and2 {{candidate template ignored: constraints not satisfied [with T = int, U = <int>]}} - // expected-note@#and2 {{because 'typename T::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#and2 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} static_assert(And3<S>() == 3); static_assert(And3<S, S>() == 3); static_assert(And3<int>() == 3); // expected-error {{no matching function for call to 'And3'}} // expected-note@#and3 {{candidate template ignored: constraints not satisfied [with T = int, U = <>]}} - // expected-note@#and3 {{because 'typename T::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#and3 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} static_assert(And3<int, int>() == 3); // expected-error {{no matching function for call to 'And3'}} // expected-note@#and3 {{candidate template ignored: constraints not satisfied [with T = int, U = <int>]}} - // expected-note@#and3 {{because 'typename T::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#and3 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} static_assert(And3<S, int>() == 3); // expected-error {{no matching function for call to 'And3'}} // expected-note@#and3 {{candidate template ignored: constraints not satisfied [with T = S, U = <int>]}} - // expected-note@#and3 {{because 'typename U::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#and3 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} static_assert(And3<int, S>() == 3); // expected-error {{no matching function for call to 'And3'}} // expected-note@#and3 {{candidate template ignored: constraints not satisfied [with T = int, U = <S>]}} - // expected-note@#and3 {{because 'typename T::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#and3 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} static_assert(Or1<>() == 1); // expected-error {{no matching function for call to 'Or1'}} @@ -227,8 +216,7 @@ static_assert(Or1<S, int>() == 1); static_assert(Or1<S, S>() == 1); static_assert(Or1<int>() == 1); // expected-error {{no matching function for call to 'Or1'}} // expected-note@#or1 {{candidate template ignored: constraints not satisfied}} - // expected-note@#or1 {{because 'typename T::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#or1 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} static_assert(Or2<S>() == 2); static_assert(Or2<int, S>() == 2); @@ -236,16 +224,14 @@ static_assert(Or2<S, int>() == 2); static_assert(Or2<S, S>() == 2); static_assert(Or2<int>() == 2); // expected-error {{no matching function for call to 'Or2'}} // expected-note@#or2 {{candidate template ignored: constraints not satisfied [with T = int, U = <>]}} - // expected-note@#or2 {{because 'typename T::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#or2 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} static_assert(Or3<S>() == 3); static_assert(Or3<int, S>() == 3); static_assert(Or3<S, int>() == 3); static_assert(Or3<S, S>() == 3); static_assert(Or3<int>() == 3); // expected-error {{no matching function for call to 'Or3'}} // expected-note@#or3 {{candidate template ignored: constraints not satisfied}} - // expected-note@#or3 {{because 'typename T::type' does not satisfy 'C'}} - // expected-note@#C {{because 'T' does not satisfy 'A'}} + // expected-note@#or3 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} } namespace bool_conversion_break { |