diff --git a/regression-tests/test-results/version b/regression-tests/test-results/version index 07afae8645..27212aa7eb 100644 --- a/regression-tests/test-results/version +++ b/regression-tests/test-results/version @@ -1,5 +1,5 @@ -cppfront compiler v0.2.1 Build 8730:1258 +cppfront compiler v0.2.1 Build 8809:1505 Copyright(c) Herb Sutter All rights reserved SPDX-License-Identifier: CC-BY-NC-ND-4.0 diff --git a/source/build.info b/source/build.info index 87176db58d..298510fc7d 100644 --- a/source/build.info +++ b/source/build.info @@ -1 +1 @@ -"8809:1416" \ No newline at end of file +"8809:1505" \ No newline at end of file diff --git a/source/parse.h b/source/parse.h index fb29ea859f..b0f8fd817d 100644 --- a/source/parse.h +++ b/source/parse.h @@ -5777,6 +5777,9 @@ class parser ) -> std::unique_ptr { + auto modifier = std::string(); + auto modifier_plural = ""; + auto n = std::make_unique(); n->pass = is_returns ? passing_style::out : passing_style::in; n->pos = curr().position(); @@ -5784,18 +5787,22 @@ class parser // Handle optional this-specifier // if (curr() == "implicit") { + modifier = curr().as_string_view(); n->mod = parameter_declaration_node::modifier::implicit; next(); } else if (curr() == "virtual") { + modifier = curr().as_string_view(); n->mod = parameter_declaration_node::modifier::virtual_; next(); } else if (curr() == "override") { + modifier = curr().as_string_view(); n->mod = parameter_declaration_node::modifier::override_; next(); } else if (curr() == "final") { + modifier = curr().as_string_view(); n->mod = parameter_declaration_node::modifier::final_; next(); } @@ -5806,6 +5813,12 @@ class parser dir != passing_style::invalid ) { + if (!modifier.empty()) { + modifier += " "; + modifier_plural = "s"; + } + modifier += curr().as_string_view(); + if (is_returns) { if (dir == passing_style::in) { @@ -5840,6 +5853,9 @@ class parser // Now the main declaration // if (!(n->declaration = declaration(false, true, is_template))) { + if (!modifier.empty()) { + error( "'" + modifier + "' modifier" + modifier_plural + " must be followed by a valid parameter declaration", false); + } return {}; }