[PATCH] D65359: [Sema] Map from a variable template specialization in a pattern to a variable template specialization in an instantiation properly
Erik Pilkington via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 26 17:03:16 PDT 2019
erik.pilkington created this revision.
erik.pilkington added a reviewer: rsmith.
Herald added subscribers: dexonsmith, jkorous.
Previously, when instantiating `S<int>::mf` below, we would emit a reference to the declaration of S<T2>::v<char>, when we really ought to make a new declaration for `v` in the template instantiation. This caused a variety of problems, since the variable template specialization that we were using was in a dependent context. The fix is to teach FindInstantiatedDecl to map the variable instantiation from the pattern to the instantiation.
Fixes llvm.org/PR42779.
template <class T2>
struct S {
template <class T1>
static constexpr int v = 0;
void mf() { v<char>; }
};
S<int> x;
Thanks for taking a look!
Erik
https://reviews.llvm.org/D65359
Files:
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaExprMember.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65359.212027.patch
Type: text/x-patch
Size: 6833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190727/66400879/attachment-0001.bin>
More information about the cfe-commits
mailing list