diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2020-01-23 19:28:23 +0100 |
---|---|---|
committer | Paolo Carlini <paolo.carlini@oracle.com> | 2020-01-23 19:28:23 +0100 |
commit | c91072247eb066ec9c6cd0b0f949c7dae691e46c (patch) | |
tree | 6d019e1440addfdab8a7e8611a0b287df5576a6f /gcc/cp | |
parent | 6f346913f2a87e26c6095d9fbf3d20f926c5470a (diff) | |
download | gcc-c91072247eb066ec9c6cd0b0f949c7dae691e46c.zip gcc-c91072247eb066ec9c6cd0b0f949c7dae691e46c.tar.gz gcc-c91072247eb066ec9c6cd0b0f949c7dae691e46c.tar.bz2 |
Fix "PR c++/92804 ICE trying to use concept as a nested-name-specifier"
A rather simple ICE where we failed to properly check for concept-ids
uses in nested-name-specifiers.
Tested x86_64-linux.
/cp
PR c++/92804
* parser.c (cp_parser_nested_name_specifier_opt): Properly
diagnose concept-ids.
/testsuite
PR c++/92804
* g++.dg/concepts/pr92804-1.C: New.
* g++.dg/concepts/pr92804-2.C: New.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 23 |
2 files changed, 23 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b13ee2b..c01bece 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2020-01-23 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/92804 + * parser.c (cp_parser_nested_name_specifier_opt): Properly + diagnose concept-ids. + 2020-01-23 Jason Merrill <jason@redhat.com> PR c++/93331 - ICE with __builtin_strchr. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index dc07dc5..72037ee 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -6467,16 +6467,27 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser, tree fns = get_fns (tid); if (OVL_SINGLE_P (fns)) tmpl = OVL_FIRST (fns); - error_at (token->location, "function template-id %qD " - "in nested-name-specifier", tid); + if (function_concept_p (fns)) + error_at (token->location, "concept-id %qD " + "in nested-name-specifier", tid); + else + error_at (token->location, "function template-id " + "%qD in nested-name-specifier", tid); } else { - /* Variable template. */ tmpl = TREE_OPERAND (tid, 0); - gcc_assert (variable_template_p (tmpl)); - error_at (token->location, "variable template-id %qD " - "in nested-name-specifier", tid); + if (variable_concept_p (tmpl) + || standard_concept_p (tmpl)) + error_at (token->location, "concept-id %qD " + "in nested-name-specifier", tid); + else + { + /* Variable template. */ + gcc_assert (variable_template_p (tmpl)); + error_at (token->location, "variable template-id " + "%qD in nested-name-specifier", tid); + } } if (tmpl) inform (DECL_SOURCE_LOCATION (tmpl), |