Skip to content

Commit 66581b0

Browse files
committed
Add usability error message for "throw expr" without parens
And update dates to 2026
1 parent 1a6062a commit 66581b0

File tree

14 files changed

+26
-16
lines changed

14 files changed

+26
-16
lines changed

include/cpp2regex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ template<typename CharT, typename matcher> class regular_expression;
8282

8383
#line 1 "cpp2regex.h2"
8484

85-
// Copyright 2022-2025 Herb Sutter
85+
// Copyright 2022-2026 Herb Sutter
8686
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8787
//
8888
// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions.

include/cpp2regex.h2

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

2-
// Copyright 2022-2025 Herb Sutter
2+
// Copyright 2022-2026 Herb Sutter
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
55
// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions.

include/cpp2util.h

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

2-
// Copyright 2022-2025 Herb Sutter
2+
// Copyright 2022-2026 Herb Sutter
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
55
// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

2-
cppfront compiler v0.8.2 Build AA17:1543
2+
cppfront compiler v0.8.2 Build B104:1508
33
SPDX-License-Identifier Apache-2.0 WITH LLVM-exception
4-
Copyright (c) 2022-2025 Herb Sutter
4+
Copyright (c) 2022-2026 Herb Sutter

source/build.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"AA17:1543"
1+
"B104:1508"

source/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
// Copyright 2022-2025 Herb Sutter
2+
// Copyright 2022-2026 Herb Sutter
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
55
// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -913,7 +913,7 @@ class cmdline_processor
913913
#include "build.info"
914914
);
915915
print("\nSPDX-License-Identifier Apache-2.0 WITH LLVM-exception");
916-
print("\nCopyright (c) 2022-2025 Herb Sutter\n");
916+
print("\nCopyright (c) 2022-2026 Herb Sutter\n");
917917
}
918918

919919
} cmdline;

source/cppfront.cpp

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

2-
// Copyright 2022-2025 Herb Sutter
2+
// Copyright 2022-2026 Herb Sutter
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
55
// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions.

source/io.h

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

2-
// Copyright 2022-2025 Herb Sutter
2+
// Copyright 2022-2026 Herb Sutter
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
55
// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions.

source/lex.h

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

2-
// Copyright 2022-2025 Herb Sutter
2+
// Copyright 2022-2026 Herb Sutter
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
55
// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions.

source/parse.h

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

2-
// Copyright 2022-2025 Herb Sutter
2+
// Copyright 2022-2026 Herb Sutter
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
55
// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -6980,6 +6980,16 @@ class parser
69806980
auto postfix_expression()
69816981
-> std::unique_ptr<postfix_expression_node>
69826982
{
6983+
if (
6984+
curr() == "throw"
6985+
&& peek(1)
6986+
&& peek(1)->type() != lexeme::LeftParen
6987+
)
6988+
{
6989+
error("'throw " + peek(1)->to_string() + "' is not allowed without parentheses - did you mean 'throw (" + *peek(1) + "))' ?");
6990+
return {};
6991+
}
6992+
69836993
auto n = std::make_unique<postfix_expression_node>();
69846994
n->expr = primary_expression();
69856995
if (!(n->expr)) {

0 commit comments

Comments
 (0)