
This fixes PR20671, see the bug for details. In short, ActOnTranslationUnit() calls DefineUsedVTables() and only then PerformPendingInstantiations(). But PerformPendingInstantiations() is what does delayed template parsing, so vtables only references from late-parsed templates weren't marked used. As a fix, move the SavePendingInstantiationsAndVTableUsesRAII in PerformPendingInstantiations() up above the delayed template parsing code. That way, vtables referenced from templates end up in the RAII object, and the call to DefineUsedVTables() in PerformPendingInstantiations() marks them used. llvm-svn: 215786
13 lines
400 B
C++
13 lines
400 B
C++
// RUN: %clang_cc1 -emit-llvm -fdelayed-template-parsing -std=c++11 -o - -triple=i386-pc-win32 %s > %t
|
|
// RUN: FileCheck %s < %t
|
|
|
|
// PR20671
|
|
namespace vtable_referenced_from_template {
|
|
struct ImplicitCtor {
|
|
virtual ~ImplicitCtor();
|
|
};
|
|
template <class T> void foo(T t) { new ImplicitCtor; }
|
|
void bar() { foo(0); }
|
|
// CHECK: store {{.*}} @"\01??_7ImplicitCtor@vtable_referenced_from_template@@6B@"
|
|
}
|