| 1 |
// RUN: %clang_cc1 -std=c++20 -Wdeprecated-declarations -verify %s |
| 2 |
|
| 3 |
struct A { |
| 4 |
[[deprecated("use something else")]] int x = 42; // expected-note {{marked deprecated here}} |
| 5 |
}; |
| 6 |
|
| 7 |
A makeDefaultA() { return {}; } // ctor is implicit → no warn |
| 8 |
A copyA(const A &a) { return a; } // copy-ctor implicit → no warn |
| 9 |
|
| 10 |
void assignA() { |
| 11 |
A a, b; |
| 12 |
a = b; // copy-assign implicit → no warn |
| 13 |
} |
| 14 |
|
| 15 |
void useA() { |
| 16 |
A a; |
| 17 |
(void)a.x; // expected-warning {{is deprecated}} |
| 18 |
} |
| 19 |
|
| 20 |
// Explicitly-defaulted ctor – now silent |
| 21 |
struct B { |
| 22 |
[[deprecated]] int y; |
| 23 |
B() = default; // no warning under new policy |
| 24 |
}; |