Skip to content

Commit d2a6cd7

Browse files
committed
Add diagnostic to disallow a parameter-direction on a template parameter, closes #425
1 parent d88f72a commit d2a6cd7

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
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 8812:1229
2+
cppfront compiler v0.2.1 Build 8812:1231
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-
"8812:1229"
1+
"8812:1231"

source/parse.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4731,7 +4731,7 @@ class parser
47314731
}
47324732
}
47334733

4734-
//G expression: // eliminated 'condition:' - just use 'expression:'
4734+
//G expression: // eliminated 'condition:' - just use 'expression:'
47354735
//G assignment-expression
47364736
//GTODO try expression
47374737
//G
@@ -4972,6 +4972,7 @@ class parser
49724972

49734973
//G unqualified-id:
49744974
//G identifier
4975+
//G keyword
49754976
//G template-id
49764977
//GTODO operator-function-id
49774978
//G
@@ -5168,7 +5169,7 @@ class parser
51685169
}
51695170

51705171

5171-
//G id-expression
5172+
//G id-expression:
51725173
//G qualified-id
51735174
//G unqualified-id
51745175
//G
@@ -6013,6 +6014,11 @@ class parser
60136014
dir != passing_style::invalid
60146015
)
60156016
{
6017+
if (is_template) {
6018+
error("a template parameter cannot have a passing style (it is always implicitly 'in')");
6019+
return {};
6020+
}
6021+
60166022
if (!modifier.empty()) {
60176023
modifier += " ";
60186024
modifier_plural = "s";

0 commit comments

Comments
 (0)