diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2013-02-07 05:08:22 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2013-02-07 05:08:22 +0000 |
commit | f5a6aefa37d73fff3c47953e2c447f074e726a0e (patch) | |
tree | a1b49843be9bd3ac4b00f0dc262dde265cb52aff /test/SemaCXX/undefined-internal.cpp | |
parent | bbcd0f3ba215d5a8857b224e32b0330586a00dc6 (diff) | |
download | clang-f5a6aefa37d73fff3c47953e2c447f074e726a0e.tar.gz |
Apply the pure-virtual odr rule to other constructs which can call overloaded
operators.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/undefined-internal.cpp')
-rw-r--r-- | test/SemaCXX/undefined-internal.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/SemaCXX/undefined-internal.cpp b/test/SemaCXX/undefined-internal.cpp index 227e6b4a85..40ab33cac4 100644 --- a/test/SemaCXX/undefined-internal.cpp +++ b/test/SemaCXX/undefined-internal.cpp @@ -231,3 +231,41 @@ namespace test10 { }; } } + +namespace test11 { + namespace { + struct A { + virtual bool operator()() const = 0; + virtual void operator!() const = 0; + virtual bool operator+(const A&) const = 0; + virtual int operator[](int) const = 0; + virtual const A* operator->() const = 0; + int member; + }; + + struct B { + bool operator()() const; // expected-warning {{function 'test11::<anonymous namespace>::B::operator()' has internal linkage but is not defined}} + void operator!() const; // expected-warning {{function 'test11::<anonymous namespace>::B::operator!' has internal linkage but is not defined}} + bool operator+(const B&) const; // expected-warning {{function 'test11::<anonymous namespace>::B::operator+' has internal linkage but is not defined}} + int operator[](int) const; // expected-warning {{function 'test11::<anonymous namespace>::B::operator[]' has internal linkage but is not defined}} + const B* operator->() const; // expected-warning {{function 'test11::<anonymous namespace>::B::operator->' has internal linkage but is not defined}} + int member; + }; + } + + void test1(A &a1, A &a2) { + a1(); + !a1; + a1 + a2; + a1[0]; + (void)a1->member; + } + + void test2(B &b1, B &b2) { + b1(); // expected-note {{used here}} + !b1; // expected-note {{used here}} + b1 + b2; // expected-note {{used here}} + b1[0]; // expected-note {{used here}} + (void)b1->member; // expected-note {{used here}} + } +} |