The standard is pretty clear on what it allows inside of template
arguments for non-type template parameters of pointer-to-member.
They must be of the form &qualified-id and cannot come from sources like
constexpr VarDecls or things of that nature.
This fixes PR18192.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196852
91177308-0d34-0410-b5e6-
96231b3b80d8
else if ((DRE = dyn_cast<DeclRefExpr>(Arg))) {
if (ValueDecl *VD = dyn_cast<ValueDecl>(DRE->getDecl())) {
if (VD->getType()->isMemberPointerType()) {
- if (isa<NonTypeTemplateParmDecl>(VD) ||
- (isa<VarDecl>(VD) &&
- S.Context.getCanonicalType(VD->getType()).isConstQualified())) {
+ if (isa<NonTypeTemplateParmDecl>(VD)) {
if (Arg->isTypeDependent() || Arg->isValueDependent()) {
Converted = TemplateArgument(Arg);
} else {
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
struct Y {
int x;
};
}
S<int> s;
}
+
+namespace PR18192 {
+ struct A { struct { int n; }; };
+ template<int A::*> struct X {};
+ constexpr int A::*p = &A::n;
+ X<p> x; // expected-error{{not a pointer to member constant}}
+}