Skip to content

Commit 5665255

Browse files
committed
Fix bug that was diagnosing non-paren sizeof incorrectly, closes #566
1 parent 4bdd9b4 commit 5665255

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-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.2.1 Build 8809:1933
2+
cppfront compiler v0.2.1 Build 8809:2009
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-
"8809:1933"
1+
"8809:2009"

source/parse.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4884,7 +4884,11 @@ class parser
48844884
error( "use 'new<" + curr().to_string(true) + ">', not 'new " + curr().to_string(true) + "'", false);
48854885
return {};
48864886
}
4887-
if (*n->identifier == "sizeof") {
4887+
if (
4888+
*n->identifier == "sizeof"
4889+
&& curr().type() != lexeme::LeftParen
4890+
)
4891+
{
48884892
error( "use 'sizeof(" + curr().to_string(true) + ")', not 'sizeof " + curr().to_string(true) + "'", false);
48894893
return {};
48904894
}

0 commit comments

Comments
 (0)