2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2009-09-01 03:52:13 +08:00
|
|
|
|
|
|
|
class X {
|
|
|
|
public:
|
|
|
|
int operator++();
|
|
|
|
operator int();
|
|
|
|
};
|
|
|
|
|
|
|
|
void test() {
|
|
|
|
X x;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = x.operator++();
|
|
|
|
i = x.operator int();
|
|
|
|
x.operator--(); // expected-error{{no member named 'operator--'}}
|
|
|
|
x.operator float(); // expected-error{{no member named 'operator float'}}
|
2010-11-04 01:52:57 +08:00
|
|
|
x.operator; // expected-error{{expected a type}}
|
2009-09-01 03:52:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void test2() {
|
|
|
|
X *x;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = x->operator++();
|
|
|
|
i = x->operator int();
|
|
|
|
x->operator--(); // expected-error{{no member named 'operator--'}}
|
|
|
|
x->operator float(); // expected-error{{no member named 'operator float'}}
|
2010-11-04 01:52:57 +08:00
|
|
|
x->operator; // expected-error{{expected a type}}
|
2009-09-01 03:52:13 +08:00
|
|
|
}
|
2012-07-21 04:40:35 +08:00
|
|
|
|
|
|
|
namespace pr13157 {
|
|
|
|
class A { public: void operator()(int x, int y = 2, ...) {} };
|
|
|
|
void f() { A()(1); }
|
|
|
|
}
|