[PATCH] D113146: [Sema] Fix the assertion in Sema::ActOnDependentMemberExpr
Yuanfang Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 4 13:08:27 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe902ffe6d756: [Sema] Fix the assertion in Sema::ActOnDependentMemberExpr (authored by ychen).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113146/new/
https://reviews.llvm.org/D113146
Files:
clang/lib/Sema/SemaExprMember.cpp
clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
Index: clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
===================================================================
--- clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
+++ clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
@@ -394,6 +394,18 @@
template<int = 0> static int n; // expected-note {{here}}
}
int &t = B::template n; // expected-error {{use of variable template 'n' requires template arguments}}
+
+ struct C {
+ template <class T> static T G;
+ };
+ template<class T> T C::G = T(6);
+
+ template <class T> T F() {
+ C c;
+ return c.G<T>;
+ }
+
+ int cf() { return F<int>(); }
}
#ifndef PRECXX11
Index: clang/lib/Sema/SemaExprMember.cpp
===================================================================
--- clang/lib/Sema/SemaExprMember.cpp
+++ clang/lib/Sema/SemaExprMember.cpp
@@ -504,9 +504,12 @@
}
}
- assert(BaseType->isDependentType() ||
- NameInfo.getName().isDependentName() ||
- isDependentScopeSpecifier(SS));
+ assert(BaseType->isDependentType() || NameInfo.getName().isDependentName() ||
+ isDependentScopeSpecifier(SS) ||
+ (TemplateArgs && llvm::any_of(TemplateArgs->arguments(),
+ [](const TemplateArgumentLoc &Arg) {
+ return Arg.getArgument().isDependent();
+ })));
// Get the type being accessed in BaseType. If this is an arrow, the BaseExpr
// must have pointer type, and the accessed type is the pointee.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113146.397384.patch
Type: text/x-patch
Size: 1569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220104/a43f75ea/attachment.bin>
More information about the cfe-commits
mailing list