diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 6387e375dda79..b98904ea3a2bb 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -16009,6 +16009,8 @@ static bool Evaluate(APValue &Result, EvalInfo &Info, const Expr *E) { if (!EvaluateAtomic(E, nullptr, Result, Info)) return false; } + } else if (T->isDependentType()) { + return false; } else if (Info.getLangOpts().CPlusPlus11) { Info.FFDiag(E, diag::note_constexpr_nonliteral) << E->getType(); return false; diff --git a/clang/test/SemaCXX/cxx2a-template-lambdas.cpp b/clang/test/SemaCXX/cxx2a-template-lambdas.cpp index 00ba291fbd198..8a7191f76c3e1 100644 --- a/clang/test/SemaCXX/cxx2a-template-lambdas.cpp +++ b/clang/test/SemaCXX/cxx2a-template-lambdas.cpp @@ -43,13 +43,11 @@ struct ShadowMe { #if __cplusplus >= 201102L template constexpr T outer() { - // FIXME: The C++11 error seems wrong return []() { return x; }.template operator()<123>(); // expected-error {{no matching member function}} \ expected-note {{candidate template ignored}} \ - cxx11-note {{non-literal type '' cannot be used in a constant expression}} \ cxx14-note {{non-literal type}} } -static_assert(outer() == 123); // cxx11-cxx14-error {{not an integral constant expression}} cxx11-cxx14-note {{in call}} +static_assert(outer() == 123); // cxx11-cxx14-error {{not an integral constant expression}} cxx14-note {{in call}} template int *outer(); // expected-note {{in instantiation}} #endif