Commit ff2f581b by Paolo Carlini Committed by Paolo Carlini

re PR c++/51989 (std::deque::iterator recognised as container)

/cp
2012-03-02  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51989
	* typeck2.c (build_x_arrow): Take a tsubst_flags_t argument and
	propagate it.
	* cp-tree.h (build_x_arrow): Adjust prototype.
	* pt.c (tsubst_copy_and_build): Adjust call.
	* parser.c (cp_parser_postfix_dot_deref_expression): Likewise.

/testsuite
2012-03-02  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51989
	* g++.dg/cpp0x/sfinae32.C: New.

From-SVN: r184796
parent 54e9d944
2012-03-02 Paolo Carlini <paolo.carlini@oracle.com> 2012-03-02 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51989
* typeck2.c (build_x_arrow): Take a tsubst_flags_t argument and
propagate it.
* cp-tree.h (build_x_arrow): Adjust prototype.
* pt.c (tsubst_copy_and_build): Adjust call.
* parser.c (cp_parser_postfix_dot_deref_expression): Likewise.
2012-03-02 Paolo Carlini <paolo.carlini@oracle.com>
* name-lookup.c (binding_to_template_parms_of_scope_p): Clean up. * name-lookup.c (binding_to_template_parms_of_scope_p): Clean up.
2012-02-29 Jason Merrill <jason@redhat.com> 2012-02-29 Jason Merrill <jason@redhat.com>
......
...@@ -5880,7 +5880,7 @@ extern void check_narrowing (tree, tree); ...@@ -5880,7 +5880,7 @@ extern void check_narrowing (tree, tree);
extern tree digest_init (tree, tree, tsubst_flags_t); extern tree digest_init (tree, tree, tsubst_flags_t);
extern tree digest_init_flags (tree, tree, int); extern tree digest_init_flags (tree, tree, int);
extern tree build_scoped_ref (tree, tree, tree *); extern tree build_scoped_ref (tree, tree, tree *);
extern tree build_x_arrow (tree); extern tree build_x_arrow (tree, tsubst_flags_t);
extern tree build_m_component_ref (tree, tree); extern tree build_m_component_ref (tree, tree);
extern tree build_functional_cast (tree, tree, tsubst_flags_t); extern tree build_functional_cast (tree, tree, tsubst_flags_t);
extern tree add_exception_specifier (tree, tree, int); extern tree add_exception_specifier (tree, tree, int);
......
...@@ -5910,7 +5910,8 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser, ...@@ -5910,7 +5910,8 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser,
/* If this is a `->' operator, dereference the pointer. */ /* If this is a `->' operator, dereference the pointer. */
if (token_type == CPP_DEREF) if (token_type == CPP_DEREF)
postfix_expression = build_x_arrow (postfix_expression); postfix_expression = build_x_arrow (postfix_expression,
tf_warning_or_error);
/* Check to see whether or not the expression is type-dependent. */ /* Check to see whether or not the expression is type-dependent. */
dependent_p = type_dependent_expression_p (postfix_expression); dependent_p = type_dependent_expression_p (postfix_expression);
/* The identifier following the `->' or `.' is not qualified. */ /* The identifier following the `->' or `.' is not qualified. */
......
...@@ -13691,7 +13691,7 @@ tsubst_copy_and_build (tree t, ...@@ -13691,7 +13691,7 @@ tsubst_copy_and_build (tree t,
/* Remember that there was a reference to this entity. */ /* Remember that there was a reference to this entity. */
if (DECL_P (op1)) if (DECL_P (op1))
mark_used (op1); mark_used (op1);
return build_x_arrow (op1); return build_x_arrow (op1, complain);
case NEW_EXPR: case NEW_EXPR:
{ {
......
...@@ -1462,7 +1462,7 @@ build_scoped_ref (tree datum, tree basetype, tree* binfo_p) ...@@ -1462,7 +1462,7 @@ build_scoped_ref (tree datum, tree basetype, tree* binfo_p)
delegation is detected. */ delegation is detected. */
tree tree
build_x_arrow (tree expr) build_x_arrow (tree expr, tsubst_flags_t complain)
{ {
tree orig_expr = expr; tree orig_expr = expr;
tree type = TREE_TYPE (expr); tree type = TREE_TYPE (expr);
...@@ -1486,7 +1486,7 @@ build_x_arrow (tree expr) ...@@ -1486,7 +1486,7 @@ build_x_arrow (tree expr)
while ((expr = build_new_op (COMPONENT_REF, LOOKUP_NORMAL, expr, while ((expr = build_new_op (COMPONENT_REF, LOOKUP_NORMAL, expr,
NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE,
&fn, tf_warning_or_error))) &fn, complain)))
{ {
if (expr == error_mark_node) if (expr == error_mark_node)
return error_mark_node; return error_mark_node;
...@@ -1497,7 +1497,8 @@ build_x_arrow (tree expr) ...@@ -1497,7 +1497,8 @@ build_x_arrow (tree expr)
if (vec_member (TREE_TYPE (expr), types_memoized)) if (vec_member (TREE_TYPE (expr), types_memoized))
{ {
error ("circular pointer delegation detected"); if (complain & tf_error)
error ("circular pointer delegation detected");
return error_mark_node; return error_mark_node;
} }
...@@ -1510,7 +1511,8 @@ build_x_arrow (tree expr) ...@@ -1510,7 +1511,8 @@ build_x_arrow (tree expr)
if (last_rval == NULL_TREE) if (last_rval == NULL_TREE)
{ {
error ("base operand of %<->%> has non-pointer type %qT", type); if (complain & tf_error)
error ("base operand of %<->%> has non-pointer type %qT", type);
return error_mark_node; return error_mark_node;
} }
...@@ -1530,13 +1532,16 @@ build_x_arrow (tree expr) ...@@ -1530,13 +1532,16 @@ build_x_arrow (tree expr)
return expr; return expr;
} }
return cp_build_indirect_ref (last_rval, RO_NULL, tf_warning_or_error); return cp_build_indirect_ref (last_rval, RO_NULL, complain);
} }
if (types_memoized) if (complain & tf_error)
error ("result of %<operator->()%> yields non-pointer result"); {
else if (types_memoized)
error ("base operand of %<->%> is not a pointer"); error ("result of %<operator->()%> yields non-pointer result");
else
error ("base operand of %<->%> is not a pointer");
}
return error_mark_node; return error_mark_node;
} }
......
2012-03-02 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51989
* g++.dg/cpp0x/sfinae32.C: New.
2012-03-02 Richard Guenther <rguenther@suse.de> 2012-03-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/52406 PR tree-optimization/52406
......
// PR c++/51989
// { dg-options -std=c++0x }
template <typename T>
struct is_container
{
template <typename U, typename V = decltype(((U*)0)->begin())>
static char test(U* u);
template <typename U> static long test(...);
enum { value = sizeof test<T>(0) == 1 };
};
int main()
{
return is_container<void>::value;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment