xref: /aosp_15_r20/external/clang/test/SemaCXX/cxx1y-constexpr-not-const.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -std=c++11 %s -verify
2*67e74705SXin Li // RUN: %clang_cc1 -std=c++1y %s -verify -DCXX1Y
3*67e74705SXin Li 
4*67e74705SXin Li struct X {
5*67e74705SXin Li   constexpr int f(); // @5
6*67e74705SXin Li   int f();           // @6
7*67e74705SXin Li };
8*67e74705SXin Li 
9*67e74705SXin Li #ifdef CXX1Y
10*67e74705SXin Li // FIXME: Detect this situation and provide a better recovery.
11*67e74705SXin Li 
12*67e74705SXin Li // expected-error@6 {{class member cannot be redeclared}}
13*67e74705SXin Li // expected-note@5 {{previous}}
14*67e74705SXin Li #else
15*67e74705SXin Li // expected-warning@5 {{'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior}}
16*67e74705SXin Li #endif
17