blob: a5c21e8f37c610fdad72c319fa89a8723d6766b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
struct S {
constexpr void f();
constexpr void g() const;
};
void f(const S &s) {
s.f();
s.g();
}
namespace std_example {
class debug_flag { // expected-note {{not an aggregate and has no constexpr constructors}}
public:
explicit debug_flag(bool);
constexpr bool is_on(); // expected-error {{non-literal type 'std_example::debug_flag' cannot have constexpr members}}
private:
bool flag;
};
constexpr int bar(int x, int y) // expected-note {{here}}
{ return x + y + x*y; }
int bar(int x, int y) // expected-error {{non-constexpr declaration of 'bar' follows constexpr declaration}}
{ return x * 2 + 3 * y; }
}
|