xref: /llvm-project/clang/test/SemaCXX/deprecated-builtins.cpp (revision b1dc62f139ef265a36a2a739ce9ba4e1e48a6dbe)
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 
3 struct A {};
4 
f()5 void f() {
6     bool a;
7 
8     a = __has_nothrow_assign(A);  // expected-warning-re {{__has_nothrow_assign {{.*}} use __is_nothrow_assignable}}
9     a = __has_nothrow_move_assign(A);  // expected-warning-re {{__has_nothrow_move_assign {{.*}} use __is_nothrow_assignable}}
10     a = __has_nothrow_copy(A);  // expected-warning-re {{__has_nothrow_copy {{.*}} use __is_nothrow_constructible}}
11     a = __has_nothrow_constructor(A);  // expected-warning-re {{__has_nothrow_constructor {{.*}} use __is_nothrow_constructible}}
12     a = __has_trivial_assign(A);  // expected-warning-re {{__has_trivial_assign {{.*}} use __is_trivially_assignable}}
13     a = __has_trivial_move_assign(A);  // expected-warning-re {{__has_trivial_move_assign {{.*}} use __is_trivially_assignable}}
14     a = __has_trivial_copy(A);  // expected-warning-re {{__has_trivial_copy {{.*}} use __is_trivially_copyable}}
15     a = __has_trivial_constructor(A);  // expected-warning-re {{__has_trivial_constructor {{.*}} use __is_trivially_constructible}}
16     a = __has_trivial_move_constructor(A);  // expected-warning-re {{__has_trivial_move_constructor {{.*}} use __is_trivially_constructible}}
17     a = __has_trivial_destructor(A);  // expected-warning-re {{__has_trivial_destructor {{.*}} use __is_trivially_destructible}}
18 
19 }
20 
test_builtin_empty_parentheses_diags(void)21 void test_builtin_empty_parentheses_diags(void) {
22     __has_nothrow_copy(); // expected-error {{expected a type}}
23     __has_nothrow_copy(1); // expected-error {{expected a type}}
24 }
25