return ExprError();
RefExpr = CreateBuiltinUnaryOp(Loc, UnaryOperator::AddrOf, move(RefExpr));
+
+ // We might need to perform a trailing qualification conversion, since
+ // the element type on the parameter could be more qualified than the
+ // element type in the expression we constructed.
+ if (IsQualificationConversion(((Expr*) RefExpr.get())->getType(),
+ ParamType.getUnqualifiedType())) {
+ Expr *RefE = RefExpr.takeAs<Expr>();
+ ImpCastExprToType(RefE, ParamType.getUnqualifiedType(),
+ CastExpr::CK_NoOp);
+ RefExpr = Owned(RefE);
+ }
+
assert(!RefExpr.isInvalid() &&
Context.hasSameType(((Expr*) RefExpr.get())->getType(),
- ParamType));
+ ParamType.getUnqualifiedType()));
return move(RefExpr);
}
}
}
};
-int main(int argc, char *argv[]) {
+void test_stringswitch(int argc, char *argv[]) {
(void)StringSwitch<int>();
}
+
+namespace PR6986 {
+ template<class Class,typename Type,Type Class::*>
+ struct non_const_member_base
+ {
+ };
+
+ template<class Class,typename Type,Type Class::*PtrToMember>
+ struct member: non_const_member_base<Class,Type,PtrToMember>
+ {
+ };
+
+ struct test_class
+ {
+ int int_member;
+ };
+ typedef member< test_class,const int,&test_class::int_member > ckey_m;
+ void test()
+ {
+ ckey_m m;
+ }
+}