[PATCH] D92413: Argument dependent lookup with class argument is recursing into base classes that haven't been instantiated. This is generating an assertion in DeclTemplate.h. Fix for Bug25668.
Kostya Kortchinsky via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 1 11:19:59 PST 2020
cryptoad created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
cryptoad requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92413
Files:
clang/lib/Sema/SemaLookup.cpp
clang/lib/Sema/SemaOpenMP.cpp
clang/test/OpenMP/template-specialization.cpp
Index: clang/test/OpenMP/template-specialization.cpp
===================================================================
--- /dev/null
+++ clang/test/OpenMP/template-specialization.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -verify -fopenmp -fsyntax-only %s
+
+// expected-no-diagnostics
+
+template <typename T>
+struct z {
+ static void aj() {
+ T f;
+#pragma omp target map(f)
+ ;
+ }
+};
+
+template <typename> class ar {};
+template <int> struct as {};
+template class z<ar<as<4>>>;
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -17549,6 +17549,7 @@
auto &DeclNames = SemaRef.getASTContext().DeclarationNames;
MapperId.setName(DeclNames.getIdentifier(
&SemaRef.getASTContext().Idents.get("default")));
+ MapperId.setLoc(StartLoc);
}
// Iterators to find the current unresolved mapper expression.
Index: clang/lib/Sema/SemaLookup.cpp
===================================================================
--- clang/lib/Sema/SemaLookup.cpp
+++ clang/lib/Sema/SemaLookup.cpp
@@ -2576,6 +2576,8 @@
bool addClassTransitive(CXXRecordDecl *RD) {
Classes.insert(RD);
+ if (InstantiationLoc.isInvalid())
+ InstantiationLoc = RD->getLocation();
return ClassesTransitive.insert(RD);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92413.308717.patch
Type: text/x-patch
Size: 1382 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201201/fd6c3324/attachment.bin>
More information about the cfe-commits
mailing list