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