diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2013-02-12 08:08:54 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2013-02-12 08:08:54 +0000 |
commit | 3c86a5c2f60d4f68afde96e2138b6933b30d6aa8 (patch) | |
tree | a0c5180bb7f1e6bc768481cfabfd1076ee4245bd /test/SemaCXX/undefined-internal.cpp | |
parent | 06098586f1de7ec5e12ccc3a2291782dee99cd1e (diff) |
The meat of this patch is in BuildCXXMemberCalLExpr where we make it use
MarkMemberReferenced instead of marking functions referenced directly. An audit
of callers to MarkFunctionReferenced and DiagnoseUseOfDecl also caused a few
other changes:
* don't mark functions odr-used when considering them for an initialization
sequence. Do mark them referenced though.
* the function nominated by the cleanup attribute should be diagnosed.
* operator new/delete should be diagnosed when building a 'new' expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174951 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/undefined-internal.cpp')
-rw-r--r-- | test/SemaCXX/undefined-internal.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/SemaCXX/undefined-internal.cpp b/test/SemaCXX/undefined-internal.cpp index 40ab33cac4..e8810adadf 100644 --- a/test/SemaCXX/undefined-internal.cpp +++ b/test/SemaCXX/undefined-internal.cpp @@ -269,3 +269,40 @@ namespace test11 { (void)b1->member; // expected-note {{used here}} } } + +namespace test12 { + class T1 {}; class T2 {}; class T3 {}; class T4 {}; class T5 {}; class T6 {}; + class T7 {}; + + namespace { + struct Cls { + virtual void f(int) = 0; + virtual void f(int, double) = 0; + void g(int); // expected-warning {{function 'test12::<anonymous namespace>::Cls::g' has internal linkage but is not defined}} + void g(int, double); + virtual operator T1() = 0; + virtual operator T2() = 0; + virtual operator T3&() = 0; + operator T4(); // expected-warning {{function 'test12::<anonymous namespace>::Cls::operator T4' has internal linkage but is not defined}} + operator T5(); // expected-warning {{function 'test12::<anonymous namespace>::Cls::operator T5' has internal linkage but is not defined}} + operator T6&(); // expected-warning {{function 'test12::<anonymous namespace>::Cls::operator class test12::T6 &' has internal linkage but is not defined}} + }; + + struct Cls2 { + Cls2(T7); // expected-warning {{function 'test12::<anonymous namespace>::Cls2::Cls2' has internal linkage but is not defined}} + }; + } + + void test(Cls &c) { + c.f(7); + c.g(7); // expected-note {{used here}} + (void)static_cast<T1>(c); + T2 t2 = c; + T3 &t3 = c; + (void)static_cast<T4>(c); // expected-note {{used here}} + T5 t5 = c; // expected-note {{used here}} + T6 &t6 = c; // expected-note {{used here}} + + Cls2 obj1((T7())); // expected-note {{used here}} + } +} |