Skip to content

Commit c80f12a

Browse files
committed
Comment out constexpr emission for lambdas until we can take a dependency on broad C++23 support
1 parent 089a534 commit c80f12a

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

regression-tests/test-results/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
cppfront compiler v0.3.0 Build 8C02:1745
2+
cppfront compiler v0.3.0 Build 8C03:1133
33
Copyright(c) Herb Sutter All rights reserved
44

55
SPDX-License-Identifier: CC-BY-NC-ND-4.0

source/build.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"8C02:1745"
1+
"8C03:1133"

source/to_cpp1.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4601,7 +4601,16 @@ class cppfront
46014601
if (!n.my_decl->has_name())
46024602
{
46034603
if (n.my_decl->is_constexpr) {
4604-
printer.print_cpp2( " constexpr", n.position() );
4604+
// The current design path we're trying out is for all '==' functions to be
4605+
// emitted as Cpp1 'constexpr', including anonymous functions. For anonymous
4606+
// functions that have captures, the intent is that '==' implies "the result
4607+
// always the same (depends only on the arguments)." Specifically, the result
4608+
// doesn't depend on the captured state, so the captured state should be const.
4609+
// But until we want to take a dependency on C++23 (P2242) to make more lambdas
4610+
// work with 'constexpr' even when not invoked in constexpr contexts, we will
4611+
// emit it as const/whitespace instead for now.
4612+
//
4613+
// printer.print_cpp2( " constexpr", n.position() ); // deliberately disabled until future
46054614
}
46064615
else {
46074616
printer.print_cpp2( " mutable", n.position() );

0 commit comments

Comments
 (0)