From: Paolo Carlini Date: Tue, 18 Sep 2018 16:35:27 +0000 (+0000) Subject: re PR c++/85065 ([concepts] ICE with invalid use of a concept) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c99fcadae81ed49b72f87b446953e85767e56fcc;p=gcc.git re PR c++/85065 ([concepts] ICE with invalid use of a concept) /cp 2018-09-18 Paolo Carlini PR c++/85065 * cp-tree.h (NON_ERROR): New. * pt.c (auto_hash::hash): Use it. (do_auto_deduction): Likewise. /testsuite 2018-09-18 Paolo Carlini PR c++/85065 * g++.dg/concepts/pr85065.C: New. From-SVN: r264402 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f73ea2a1f3e..fdc1247746d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2018-09-18 Paolo Carlini + + PR c++/85065 + * cp-tree.h (NON_ERROR): New. + * pt.c (auto_hash::hash): Use it. + (do_auto_deduction): Likewise. + 2018-09-18 Nathan Sidwell PR c++/86881 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 6cd6e5f5886..2203e92dda8 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1877,6 +1877,8 @@ struct GTY(()) language_function { /* In parser.c. */ extern tree cp_literal_operator_id (const char *); +#define NON_ERROR(NODE) ((NODE) == error_mark_node ? NULL_TREE : (NODE)) + /* TRUE if a tree code represents a statement. */ extern bool statement_code_p[MAX_TREE_CODES]; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 892a387cbc5..b8b6545434b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -26121,7 +26121,7 @@ struct auto_hash : default_hash_traits inline hashval_t auto_hash::hash (tree t) { - if (tree c = PLACEHOLDER_TYPE_CONSTRAINTS (t)) + if (tree c = NON_ERROR (PLACEHOLDER_TYPE_CONSTRAINTS (t))) /* Matching constrained-type-specifiers denote the same template parameter, so hash the constraint. */ return hash_placeholder_constraint (c); @@ -26880,7 +26880,7 @@ do_auto_deduction (tree type, tree init, tree auto_node, /* Check any placeholder constraints against the deduced type. */ if (flag_concepts && !processing_template_decl) - if (tree constr = PLACEHOLDER_TYPE_CONSTRAINTS (auto_node)) + if (tree constr = NON_ERROR (PLACEHOLDER_TYPE_CONSTRAINTS (auto_node))) { /* Use the deduced type to check the associated constraints. If we have a partial-concept-id, rebuild the argument list so that diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3c96db42b62..7a7a7c24563 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-09-18 Paolo Carlini + + PR c++/85065 + * g++.dg/concepts/pr85065.C: New. + 2018-09-18 Kyrylo Tkachov PR testsuite/87339 @@ -11,10 +16,10 @@ 2018-09-18 Kyrylo Tkachov - * gcc.target/aarch64/spellcheck_1.c: - Make architecture suggestion optional. - * gcc.target/aarch64/spellcheck_4.c: - Likewise. + * gcc.target/aarch64/spellcheck_1.c: + Make architecture suggestion optional. + * gcc.target/aarch64/spellcheck_4.c: + Likewise. 2018-09-18 Kyrylo Tkachov diff --git a/gcc/testsuite/g++.dg/concepts/pr85065.C b/gcc/testsuite/g++.dg/concepts/pr85065.C new file mode 100644 index 00000000000..861a838dd29 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/pr85065.C @@ -0,0 +1,6 @@ +// { dg-do compile { target c++14 } } +// { dg-additional-options "-fconcepts" } + +template concept bool C = true; + +C c = 0; // { dg-error "invalid reference to concept" }