re PR c++/85065 ([concepts] ICE with invalid use of a concept)

/cp
2018-09-18  Paolo Carlini  <paolo.carlini@oracle.com>

	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  <paolo.carlini@oracle.com>

	PR c++/85065
	* g++.dg/concepts/pr85065.C: New.

From-SVN: r264402
This commit is contained in:
Paolo Carlini 2018-09-18 16:35:27 +00:00
parent b7663a763f
commit c99fcadae8
5 changed files with 26 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2018-09-18 Paolo Carlini <paolo.carlini@oracle.com>
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 <nathan@acm.org> 2018-09-18 Nathan Sidwell <nathan@acm.org>
PR c++/86881 PR c++/86881

View File

@ -1877,6 +1877,8 @@ struct GTY(()) language_function {
/* In parser.c. */ /* In parser.c. */
extern tree cp_literal_operator_id (const char *); 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. */ /* TRUE if a tree code represents a statement. */
extern bool statement_code_p[MAX_TREE_CODES]; extern bool statement_code_p[MAX_TREE_CODES];

View File

@ -26121,7 +26121,7 @@ struct auto_hash : default_hash_traits<tree>
inline hashval_t inline hashval_t
auto_hash::hash (tree 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 /* Matching constrained-type-specifiers denote the same template
parameter, so hash the constraint. */ parameter, so hash the constraint. */
return hash_placeholder_constraint (c); 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. */ /* Check any placeholder constraints against the deduced type. */
if (flag_concepts && !processing_template_decl) 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 /* Use the deduced type to check the associated constraints. If we
have a partial-concept-id, rebuild the argument list so that have a partial-concept-id, rebuild the argument list so that

View File

@ -1,3 +1,8 @@
2018-09-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/85065
* g++.dg/concepts/pr85065.C: New.
2018-09-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2018-09-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR testsuite/87339 PR testsuite/87339
@ -11,10 +16,10 @@
2018-09-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2018-09-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.target/aarch64/spellcheck_1.c: * gcc.target/aarch64/spellcheck_1.c:
Make architecture suggestion optional. Make architecture suggestion optional.
* gcc.target/aarch64/spellcheck_4.c: * gcc.target/aarch64/spellcheck_4.c:
Likewise. Likewise.
2018-09-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2018-09-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>

View File

@ -0,0 +1,6 @@
// { dg-do compile { target c++14 } }
// { dg-additional-options "-fconcepts" }
template<int> concept bool C = true;
C c = 0; // { dg-error "invalid reference to concept" }