opnsense-src/test/SemaCXX/function-type-qual.cpp

24 lines
701 B
C++
Raw Normal View History

2010-01-01 05:34:51 -05:00
// RUN: %clang_cc1 -fsyntax-only -verify %s
2009-06-02 13:58:47 -04:00
void f() const; // expected-error {{type qualifier is not allowed on this function}}
typedef void cfn() const;
cfn f2; // expected-error {{a qualified function type cannot be used to declare a nonmember function or a static member function}}
class C {
void f() const;
cfn f2;
static void f3() const; // expected-error {{type qualifier is not allowed on this function}}
static cfn f4; // expected-error {{a qualified function type cannot be used to declare a nonmember function or a static member function}}
void m1() {
x = 0;
}
void m2() const {
x = 0; // expected-error {{read-only variable is not assignable}}
}
int x;
};