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