summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-06-19 16:11:58 -0400
committerJason Merrill <jason@redhat.com>2016-06-21 21:50:19 +0300
commitd0fd50931a9774e0002bfb530584cf31839e0099 (patch)
tree35fad51fdac181eddd1e5c3ffeee1bd0b3310f89
parent2aa2c7d6420d9722d1272c1fad48439f0796fc3c (diff)
downloadgcc-d0fd50931a9774e0002bfb530584cf31839e0099.tar.gz
no-workaround
-rw-r--r--gcc/cp/constraint.cc40
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/pt.c17
3 files changed, 1 insertions, 57 deletions
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index 8b20d48dfe3..6387e9a17e2 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -1897,15 +1897,7 @@ satisfy_predicate_constraint (tree t, tree args,
gcc_assert (TREE_CODE (expr) != EXPR_PACK_EXPANSION);
/* If substitution into the expression fails, the constraint
- is not satisfied.
-
- FIXME: There is a (likely) bug related to this substitution. When a
- concept check expands to refer to a variable template, this expression
- may include references to instantiations of those templates. However,
- the substitution below fails to preserve those instantiations, and
- instead creates new uninstantiated specializations, causing the
- constraint to fail with spurious constexpr errors. This is explicitly
- guarded against in tsubst_decl and satisfy_constraint. */
+ is not satisfied. */
expr = tsubst_expr (expr, args, complain, in_decl, false);
if (expr == error_mark_node)
return boolean_false_node;
@@ -2169,22 +2161,6 @@ satisfy_constraint_1 (tree t, tree args, tsubst_flags_t complain, tree in_decl)
return boolean_false_node;
}
-static int eval_constr = 0;
-
-struct evaluating_constraints_sentinel
-{
- evaluating_constraints_sentinel()
- {
- ++eval_constr;
- }
-
- ~evaluating_constraints_sentinel()
- {
- --eval_constr;
- }
-};
-
-
/* Check that the constraint is satisfied, according to the rules
for that constraint. Note that each satisfy_* function returns
true or false, depending on whether it is satisfied or not. */
@@ -2198,9 +2174,6 @@ satisfy_constraint (tree t, tree args)
to non-dependent terms, so we want to ensure full checking here. */
processing_template_decl_sentinel proc (true);
- /* Note that we are evaluating constraints. */
- evaluating_constraints_sentinel eval;
-
/* Avoid early exit in tsubst and tsubst_copy from null args; since earlier
substitution was done with processing_template_decl forced on, there will
be expressions that still need semantic processing, possibly buried in
@@ -2346,17 +2319,6 @@ constraint_expression_satisfied_p (tree expr, tree args)
} /* namespace */
-/* Returns true when constraints are being evaluated for satisfaction.
-
- TODO: This is only used in tsubst_decl to guard against a possible
- bug in specialization registration/lookup for variable templates
- instantiated during concept expansion. */
-bool
-evaluating_constraints_p ()
-{
- return eval_constr;
-}
-
/*---------------------------------------------------------------------------
Semantic analysis of requires-expressions
---------------------------------------------------------------------------*/
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 61356bd86b7..2fa894d9433 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -6900,7 +6900,6 @@ extern tree evaluate_variable_concept (tree, tree);
extern tree evaluate_constraint_expression (tree, tree);
extern bool constraints_satisfied_p (tree);
extern bool constraints_satisfied_p (tree, tree);
-extern bool evaluating_constraints_p ();
extern tree lookup_constraint_satisfaction (tree, tree);
extern tree memoize_constraint_satisfaction (tree, tree, tree);
extern tree lookup_concept_satisfaction (tree, tree);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index c8bb57ad984..0e6d36fcaad 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -12314,23 +12314,6 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
if (!spec)
{
- if (evaluating_constraints_p()
- && VAR_P (t)
- && DECL_TEMPLATE_INSTANTIATED (t))
- {
- /* If the variable is already an instantiation, there are
- no viable substitutions. We get here during constraint
- satisfaction where an expanded concept refers to a
- variable template, and later we later re-substitute
- in order to evaluate the constraint.
-
- FIXME: This seems to be masking a bug where the
- specialization lookup below fails for a previously
- instantiated variable template. */
- r = t;
- break;
- }
-
tmpl = DECL_TI_TEMPLATE (t);
gen_tmpl = most_general_template (tmpl);
argvec = tsubst (DECL_TI_ARGS (t), args, complain, in_decl);