25 lines · cpp
1// RUN: %clang_cc1 -std=c++20 -Wdeprecated-declarations -verify %s2 3struct A {4 [[deprecated("use something else")]] int x = 42; // expected-note {{marked deprecated here}}5};6 7A makeDefaultA() { return {}; } // ctor is implicit → no warn8A copyA(const A &a) { return a; } // copy-ctor implicit → no warn9 10void assignA() {11 A a, b;12 a = b; // copy-assign implicit → no warn13}14 15void useA() {16 A a;17 (void)a.x; // expected-warning {{is deprecated}}18}19 20// Explicitly-defaulted ctor – now silent21struct B {22 [[deprecated]] int y;23 B() = default; // no warning under new policy24};25