From 7c2b4afc0b01cac25df584e802b91d9d351a1fee Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sat, 28 Oct 2017 01:15:00 +0000 Subject: [PATCH] Never try to instantiate a deduction guide's "definition". Fixes bogus warning when there inevitably isn't one. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316820 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaTemplateInstantiateDecl.cpp | 3 ++- test/SemaCXX/cxx1z-class-template-argument-deduction.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index d93fbd7c83..5b528fa9c2 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -3768,7 +3768,8 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, bool Recursive, bool DefinitionRequired, bool AtEndOfTU) { - if (Function->isInvalidDecl() || Function->isDefined()) + if (Function->isInvalidDecl() || Function->isDefined() || + isa(Function)) return; // Never instantiate an explicit specialization except if it is a class scope diff --git a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp index 9232a8b6eb..9080f67fe0 100644 --- a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp +++ b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -std=c++1z -verify %s -DERRORS -// RUN: %clang_cc1 -std=c++1z -verify %s -UERRORS +// RUN: %clang_cc1 -std=c++1z -verify %s -DERRORS -Wundefined-func-template +// RUN: %clang_cc1 -std=c++1z -verify %s -UERRORS -Wundefined-func-template // This test is split into two because we only produce "undefined internal" // warnings if we didn't produce any errors. -- 2.40.0