File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,8 @@ Bug Fixes in This Version
375375 Fixes (`#67690 <https://github.com/llvm/llvm-project/issues/67690 >`_)
376376- Fixes a ``clang-17 `` regression where ``LLVM_UNREACHABLE_OPTIMIZE=OFF ``
377377 cannot be used with ``Release `` mode builds. (`#68237 <https://github.com/llvm/llvm-project/issues/68237 >`_).
378+ - Fix crash in evaluating ``constexpr `` value for invalid template function.
379+ Fixes (`#68542 <https://github.com/llvm/llvm-project/issues/68542 >`_)
378380
379381Bug Fixes to Compiler Builtins
380382^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -18408,6 +18408,8 @@ static void EvaluateAndDiagnoseImmediateInvocation(
1840818408
1840918409 assert(FD && FD->isImmediateFunction() &&
1841018410 "could not find an immediate function in this expression");
18411+ if (FD->isInvalidDecl())
18412+ return;
1841118413 SemaRef.Diag(CE->getBeginLoc(), diag::err_invalid_consteval_call)
1841218414 << FD << FD->isConsteval();
1841318415 if (auto Context =
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 -verify -std=c++20 -fsyntax-only %s
2+
3+ struct S {
4+ int e;
5+ };
6+
7+ template <class T >
8+ consteval int get_format () {
9+ return nullptr ; // expected-error{{cannot initialize return object of type 'int' with an rvalue of type 'std::nullptr_t'}}
10+ }
11+
12+ template <class T >
13+ constexpr S f (T) noexcept {
14+ return get_format<T>(); // expected-error{{no viable conversion from returned value of type 'int' to function return type 'S'}}
15+ }
16+
17+ constexpr S x = f(0 ); // expected-error{{constexpr variable 'x' must be initialized by a constant expression}}
18+ // expected-note@-1{{in instantiation of function template specialization 'f<int>' requested here}}
19+ // expected-note@3{{candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'S &&' for 1st argument}}
20+ // expected-note@3{{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const S &' for 1st argument}}
You can’t perform that action at this time.
0 commit comments