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
375
375
Fixes (`#67690 <https://github.com/llvm/llvm-project/issues/67690 >`_)
376
376
- Fixes a ``clang-17 `` regression where ``LLVM_UNREACHABLE_OPTIMIZE=OFF ``
377
377
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 >`_)
378
380
379
381
Bug Fixes to Compiler Builtins
380
382
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -18408,6 +18408,8 @@ static void EvaluateAndDiagnoseImmediateInvocation(
18408
18408
18409
18409
assert(FD && FD->isImmediateFunction() &&
18410
18410
"could not find an immediate function in this expression");
18411
+ if (FD->isInvalidDecl())
18412
+ return;
18411
18413
SemaRef.Diag(CE->getBeginLoc(), diag::err_invalid_consteval_call)
18412
18414
<< FD << FD->isConsteval();
18413
18415
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