[PATCH] D63072: [clang] Fixing incorrect implicit deduction guides (PR41549)
Tyker via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 14 01:38:57 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363361: [clang] Fixing incorrect implicit deduction guides (PR41549) (authored by Tyker, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D63072?vs=203862&id=204721#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63072/new/
https://reviews.llvm.org/D63072
Files:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
Index: cfe/trunk/lib/Sema/SemaTemplate.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp
@@ -2052,6 +2052,12 @@
void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template,
SourceLocation Loc) {
+ if (CXXRecordDecl *DefRecord =
+ cast<CXXRecordDecl>(Template->getTemplatedDecl())->getDefinition()) {
+ TemplateDecl *DescribedTemplate = DefRecord->getDescribedClassTemplate();
+ Template = DescribedTemplate ? DescribedTemplate : Template;
+ }
+
DeclContext *DC = Template->getDeclContext();
if (DC->isDependentContext())
return;
Index: cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
+++ cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
@@ -489,6 +489,21 @@
}
#pragma clang diagnostic pop
+namespace PR41549 {
+
+template <class H, class P> struct umm;
+
+template <class H = int, class P = int>
+struct umm {
+ umm(H h = 0, P p = 0);
+};
+
+template <class H, class P> struct umm;
+
+umm m(1);
+
+}
+
#else
// expected-no-diagnostics
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63072.204721.patch
Type: text/x-patch
Size: 1301 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190614/a4b69567/attachment.bin>
More information about the cfe-commits
mailing list