aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/virtual-member-functions-key-function.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-01-06 04:44:19 +0000
committerDouglas Gregor <dgregor@apple.com>2010-01-06 04:44:19 +0000
commit159ef1ed9f024f73028aa3c9b27ae0717e43786c (patch)
treecc5d9f70e3b34f7a3d169586a5104b08fe013247 /test/SemaCXX/virtual-member-functions-key-function.cpp
parent8a8da7d17d4eb281b61d08d603c7bb180d280d5a (diff)
Make our marking of virtual members functions in a class be
deterministic and work properly with templates. Once a class that needs a vtable has been defined, we now do one if two things: - If the class has no key function, we place the class on a list of classes whose virtual functions will need to be "marked" at the end of the translation unit. The delay until the end of the translation unit is needed because we might see template specializations of these virtual functions. - If the class has a key function, we do nothing; when the key function is defined, the class will be placed on the aforementioned list. At the end of the translation unit, we "mark" all of the virtual functions of the classes on the list as used, possibly causing template instantiation and other classes to be added to the list. This gets LLVM's lib/Support/CommandLine.cpp compiling again. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92821 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/virtual-member-functions-key-function.cpp')
-rw-r--r--test/SemaCXX/virtual-member-functions-key-function.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/test/SemaCXX/virtual-member-functions-key-function.cpp b/test/SemaCXX/virtual-member-functions-key-function.cpp
index 3d048595e9..8da6bf5598 100644
--- a/test/SemaCXX/virtual-member-functions-key-function.cpp
+++ b/test/SemaCXX/virtual-member-functions-key-function.cpp
@@ -4,19 +4,15 @@ struct A {
};
struct B : A { // expected-error {{no suitable member 'operator delete' in 'B'}}
- B() { } // expected-note {{implicit default destructor for 'struct B' first required here}}
+ B() { }
void operator delete(void *, int); // expected-note {{'operator delete' declared here}}
-};
+}; // expected-note {{implicit default destructor for 'struct B' first required here}}
struct C : A { // expected-error {{no suitable member 'operator delete' in 'C'}}
void operator delete(void *, int); // expected-note {{'operator delete' declared here}}
-};
+}; // expected-note {{implicit default destructor for 'struct C' first required here}}
void f() {
- // new B should mark the constructor as used, which then marks
- // all the virtual members as used, because B has no key function.
(void)new B;
-
- // Same here, except that C has an implicit constructor.
- (void)new C; // expected-note {{implicit default destructor for 'struct C' first required here}}
+ (void)new C;
}