diff options
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 53b866852ae..f12f92321ae 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -11936,19 +11936,14 @@ bool Sema::DefineUsedVTables() { // vtable even though we're using it. const CXXMethodDecl *KeyFunction = Context.getCurrentKeyFunction(Class); if (KeyFunction && !KeyFunction->hasBody()) { - switch (KeyFunction->getTemplateSpecializationKind()) { - case TSK_Undeclared: - case TSK_ExplicitSpecialization: - case TSK_ExplicitInstantiationDeclaration: - // The key function is in another translation unit. - DefineVTable = false; - break; - - case TSK_ExplicitInstantiationDefinition: - case TSK_ImplicitInstantiation: - // We will be instantiating the key function. - break; - } + // The key function is in another translation unit. + DefineVTable = false; + TemplateSpecializationKind TSK = + KeyFunction->getTemplateSpecializationKind(); + assert(TSK != TSK_ExplicitInstantiationDefinition && + TSK != TSK_ImplicitInstantiation && + "Instantiations don't have key functions"); + (void)TSK; } else if (!KeyFunction) { // If we have a class with no key function that is the subject // of an explicit instantiation declaration, suppress the |

