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