Skip to content

Commit

Permalink
Add diagnostic to disallow a parameter-direction on a template parame…
Browse files Browse the repository at this point in the history
…ter, closes hsutter#425
  • Loading branch information
hsutter committed Aug 13, 2023
1 parent d88f72a commit d2a6cd7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion regression-tests/test-results/version
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

cppfront compiler v0.2.1 Build 8812:1229
cppfront compiler v0.2.1 Build 8812:1231
Copyright(c) Herb Sutter All rights reserved

SPDX-License-Identifier: CC-BY-NC-ND-4.0
Expand Down
2 changes: 1 addition & 1 deletion source/build.info
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"8812:1229"
"8812:1231"
10 changes: 8 additions & 2 deletions source/parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -4731,7 +4731,7 @@ class parser
}
}

//G expression: // eliminated 'condition:' - just use 'expression:'
//G expression: // eliminated 'condition:' - just use 'expression:'
//G assignment-expression
//GTODO try expression
//G
Expand Down Expand Up @@ -4972,6 +4972,7 @@ class parser

//G unqualified-id:
//G identifier
//G keyword
//G template-id
//GTODO operator-function-id
//G
Expand Down Expand Up @@ -5168,7 +5169,7 @@ class parser
}


//G id-expression
//G id-expression:
//G qualified-id
//G unqualified-id
//G
Expand Down Expand Up @@ -6013,6 +6014,11 @@ class parser
dir != passing_style::invalid
)
{
if (is_template) {
error("a template parameter cannot have a passing style (it is always implicitly 'in')");
return {};
}

if (!modifier.empty()) {
modifier += " ";
modifier_plural = "s";
Expand Down

0 comments on commit d2a6cd7

Please sign in to comment.