r316820 - Never try to instantiate a deduction guide's "definition". Fixes bogus warning when there inevitably isn't one.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 27 18:15:00 PDT 2017
Author: rsmith
Date: Fri Oct 27 18:15:00 2017
New Revision: 316820
URL: http://llvm.org/viewvc/llvm-project?rev=316820&view=rev
Log:
Never try to instantiate a deduction guide's "definition". Fixes bogus warning when there inevitably isn't one.
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=316820&r1=316819&r2=316820&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Fri Oct 27 18:15:00 2017
@@ -3768,7 +3768,8 @@ void Sema::InstantiateFunctionDefinition
bool Recursive,
bool DefinitionRequired,
bool AtEndOfTU) {
- if (Function->isInvalidDecl() || Function->isDefined())
+ if (Function->isInvalidDecl() || Function->isDefined() ||
+ isa<CXXDeductionGuideDecl>(Function))
return;
// Never instantiate an explicit specialization except if it is a class scope
Modified: cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp?rev=316820&r1=316819&r2=316820&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp Fri Oct 27 18:15:00 2017
@@ -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.
More information about the cfe-commits
mailing list