Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -420,6 +420,8 @@ - ``-Wformat`` will no longer suggest a no-op fix-it for fixing scoped enum format warnings. Instead, it will suggest casting the enum object to the type specified in the format string. +- Clang constexpr evaluator now prints template arguments when displaying + template-specialization function calls. Bug Fixes in This Version ------------------------- Index: clang/lib/AST/ExprConstant.cpp =================================================================== --- clang/lib/AST/ExprConstant.cpp +++ clang/lib/AST/ExprConstant.cpp @@ -1921,7 +1921,8 @@ cast(Callee)->isInstance(); if (!IsMemberCall) - Out << *Callee << '('; + Callee->getNameForDiagnostic(Out, Info.Ctx.getPrintingPolicy(), + /*Qualified=*/false); if (This && IsMemberCall) { if (const auto *MCE = dyn_cast_if_present(CallExpr)) { @@ -1946,10 +1947,13 @@ Info.Ctx.getLValueReferenceType(This->Designator.MostDerivedType)); Out << "."; } - Out << *Callee << '('; + Callee->getNameForDiagnostic(Out, Info.Ctx.getPrintingPolicy(), + /*Qualified=*/false); IsMemberCall = false; } + Out << '('; + for (FunctionDecl::param_const_iterator I = Callee->param_begin(), E = Callee->param_end(); I != E; ++I, ++ArgIndex) { if (ArgIndex > (unsigned)IsMemberCall) Index: clang/test/AST/Interp/literals.cpp =================================================================== --- clang/test/AST/Interp/literals.cpp +++ clang/test/AST/Interp/literals.cpp @@ -474,22 +474,22 @@ return 1; } static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'uninit()'}} \ + // ref-note {{in call to 'uninit()'}} \ // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'uninit()'}} \ + // ref-note {{in call to 'uninit()'}} \ // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'uninit()'}} \ + // ref-note {{in call to 'uninit()'}} \ // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ - // ref-note {{in call to 'uninit()'}} \ + // ref-note {{in call to 'uninit()'}} \ // expected-error {{not an integral constant expression}} \ // expected-note {{in call to 'uninit()'}} Index: clang/test/SemaCXX/builtin-align-cxx.cpp =================================================================== --- clang/test/SemaCXX/builtin-align-cxx.cpp +++ clang/test/SemaCXX/builtin-align-cxx.cpp @@ -137,26 +137,26 @@ constexpr long const_value(long l) { return l; } // Check some invalid values during constant-evaluation static_assert(wrap_align_down(1, const_value(-1)), ""); // expected-error{{not an integral constant expression}} -// expected-note@-1{{in call to 'wrap_align_down(1, -1)'}} +// expected-note@-1{{in call to 'wrap_align_down(1, -1)'}} static_assert(wrap_align_up(1, const_value(-2)), ""); // expected-error{{not an integral constant expression}} -// expected-note@-1{{in call to 'wrap_align_up(1, -2)'}} +// expected-note@-1{{in call to 'wrap_align_up(1, -2)'}} static_assert(wrap_is_aligned(1, const_value(-3)), ""); // expected-error{{not an integral constant expression}} -// expected-note@-1{{in call to 'wrap_is_aligned(1, -3)'}} +// expected-note@-1{{in call to 'wrap_is_aligned(1, -3)'}} static_assert(wrap_align_down(1, const_value(17)), ""); // expected-error{{not an integral constant expression}} -// expected-note@-1{{in call to 'wrap_align_down(1, 17)'}} +// expected-note@-1{{in call to 'wrap_align_down(1, 17)'}} static_assert(wrap_align_up(1, const_value(18)), ""); // expected-error{{not an integral constant expression}} -// expected-note@-1{{in call to 'wrap_align_up(1, 18)'}} +// expected-note@-1{{in call to 'wrap_align_up(1, 18)'}} static_assert(wrap_is_aligned(1, const_value(19)), ""); // expected-error{{not an integral constant expression}} -// expected-note@-1{{in call to 'wrap_is_aligned(1, 19)'}} +// expected-note@-1{{in call to 'wrap_is_aligned(1, 19)'}} // Check invalid values for smaller types: static_assert(wrap_align_down(static_cast(1), const_value(1 << 20)), ""); // expected-error{{not an integral constant expression}} -// expected-note@-1{{in call to 'wrap_align_down(1, 1048576)'}} +// expected-note@-1{{in call to 'wrap_align_down(1, 1048576)'}} // Check invalid boolean type static_assert(wrap_align_up(static_cast(1), const_value(1ull << 33)), ""); // expected-error{{not an integral constant expression}} -// expected-note@-1{{in call to 'wrap_align_up(1, 8589934592)'}} +// expected-note@-1{{in call to 'wrap_align_up(1, 8589934592)'}} static_assert(wrap_is_aligned(static_cast(1), const_value(1 << 22)), ""); // expected-error{{not an integral constant expression}} -// expected-note@-1{{in call to 'wrap_is_aligned(1, 4194304)'}} +// expected-note@-1{{in call to 'wrap_is_aligned(1, 4194304)'}} // Check invalid boolean type static_assert(wrap_align_up(static_cast(1), const_value(1 << 21)), ""); // expected-error{{not an integral constant expression}} Index: clang/test/SemaCXX/constant-expression-cxx11.cpp =================================================================== --- clang/test/SemaCXX/constant-expression-cxx11.cpp +++ clang/test/SemaCXX/constant-expression-cxx11.cpp @@ -1781,7 +1781,7 @@ static_assert(get(arr, 1) == 1, ""); static_assert(get(arr, 4) == 4, ""); static_assert(get(arr, 0) == 4, ""); // expected-error{{not an integral constant expression}} \ - // expected-note{{in call to 'get(arr, 0)'}} + // expected-note{{in call to 'get(arr, 0)'}} } namespace std { struct type_info; } Index: clang/test/SemaCXX/constant-expression-cxx14.cpp =================================================================== --- clang/test/SemaCXX/constant-expression-cxx14.cpp +++ clang/test/SemaCXX/constant-expression-cxx14.cpp @@ -1038,7 +1038,7 @@ void foo() __attribute__((enable_if(sum(Cs) == 'a' + 'b', ""))); void run() { foo(); } -static_assert(sum(Cs) == 'a' + 'b', ""); // expected-error{{not an integral constant expression}} expected-note{{in call to 'sum(Cs)'}} +static_assert(sum(Cs) == 'a' + 'b', ""); // expected-error{{not an integral constant expression}} expected-note{{in call to 'sum<2>(Cs)'}} constexpr int S = sum(Cs); // expected-error{{must be initialized by a constant expression}} expected-note{{in call}} } Index: clang/test/SemaCXX/constexpr-builtin-bit-cast.cpp =================================================================== --- clang/test/SemaCXX/constexpr-builtin-bit-cast.cpp +++ clang/test/SemaCXX/constexpr-builtin-bit-cast.cpp @@ -117,11 +117,11 @@ constexpr pad pir{4, 4}; // expected-error@+2 {{constexpr variable 'piw' must be initialized by a constant expression}} - // expected-note@+1 {{in call to 'bit_cast(pir)'}} + // expected-note@+1 {{in call to 'bit_cast(pir)'}} constexpr int piw = bit_cast(pir).x; // expected-error@+2 {{constexpr variable 'bad' must be initialized by a constant expression}} - // expected-note@+1 {{in call to 'bit_cast(pir)'}} + // expected-note@+1 {{in call to 'bit_cast(pir)'}} constexpr no_pad bad = bit_cast(pir); constexpr pad fine = bit_cast(no_pad{1, 2, 3, 4, 5}); Index: clang/test/SemaCXX/cxx2b-consteval-propagate.cpp =================================================================== --- clang/test/SemaCXX/cxx2b-consteval-propagate.cpp +++ clang/test/SemaCXX/cxx2b-consteval-propagate.cpp @@ -45,7 +45,7 @@ } int i = hh(); // expected-error {{call to immediate function 'examples::hh' is not a constant expression}} \ - // expected-note {{in call to 'hh()'}} + // expected-note {{in call to 'hh()'}} struct A { int x;