Index: lib/Sema/SemaChecking.cpp =================================================================== --- lib/Sema/SemaChecking.cpp +++ lib/Sema/SemaChecking.cpp @@ -4592,7 +4592,6 @@ case Stmt::CXXReinterpretCastExprClass: { Expr* SubExpr = cast(E)->getSubExpr(); switch (cast(E)->getCastKind()) { - case CK_BitCast: case CK_LValueToRValue: case CK_NoOp: case CK_BaseToDerived: @@ -4607,6 +4606,14 @@ case CK_ArrayToPointerDecay: return EvalVal(SubExpr, refVars, ParentDecl); + case CK_BitCast: + if (SubExpr->getType()->isAnyPointerType() || + SubExpr->getType()->isBlockPointerType() || + SubExpr->getType()->isObjCQualifiedIdType()) + return EvalAddr(SubExpr, refVars, ParentDecl); + else + return EvalVal(SubExpr, refVars, ParentDecl); + default: return nullptr; } Index: test/SemaCXX/PR20110.cpp =================================================================== --- test/SemaCXX/PR20110.cpp +++ test/SemaCXX/PR20110.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// expected-no-diagnostics + +template +class A { + char const *get_p() { return *p; } +}; +template +class B { + char const *get_p() { return p; } +}; +