]> granicus.if.org Git - clang/commitdiff
Never try to instantiate a deduction guide's "definition". Fixes bogus warning when...
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 28 Oct 2017 01:15:00 +0000 (01:15 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 28 Oct 2017 01:15:00 +0000 (01:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316820 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateInstantiateDecl.cpp
test/SemaCXX/cxx1z-class-template-argument-deduction.cpp

index d93fbd7c830def0a842348bd4c08bdc174e80eb2..5b528fa9c2e8063c02ae69d2933a9f4a4cacae64 100644 (file)
@@ -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<CXXDeductionGuideDecl>(Function))
     return;
 
   // Never instantiate an explicit specialization except if it is a class scope
index 9232a8b6eba0490f94c82dd3475cb4d051c4cd5b..9080f67fe0e11363df344c70525b9a275c5872ec 100644 (file)
@@ -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.