+2005-11-16 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ Backport from mainline:
+ 2005-10-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/23797
+ * parser.c (cp_parser_functional_cast): Cope when TYPE is not a
+ TYPE_DECL. Use dependent_type_p to check type.
+ * pt.c (uses_template_parms_p): Use dependent_type_p for a
+ TYPE_DECL.
+ (type_dependent_expression_p): Assert we've not been given a
+ TYPE_DECL.
+
2005-11-15 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/19253
cast = build_functional_cast (type, expression_list);
/* [expr.const]/1: In an integral constant expression "only type
conversions to integral or enumeration type can be used". */
- if (cast != error_mark_node && !type_dependent_expression_p (type)
- && !INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (type)))
+ if (TREE_CODE (type) == TYPE_DECL)
+ type = TREE_TYPE (type);
+ if (cast != error_mark_node && !dependent_type_p (type)
+ && !INTEGRAL_OR_ENUMERATION_TYPE_P (type))
{
if (cp_parser_non_integral_constant_expression
(parser, "a call to a constructor"))
else if (TREE_CODE (t) == TREE_LIST)
dependent_p = (uses_template_parms (TREE_VALUE (t))
|| uses_template_parms (TREE_CHAIN (t)));
+ else if (TREE_CODE (t) == TYPE_DECL)
+ dependent_p = dependent_type_p (TREE_TYPE (t));
else if (DECL_P (t)
|| EXPR_P (t)
|| TREE_CODE (t) == TEMPLATE_PARM_INDEX
abort ();
}
+ my_friendly_assert (TREE_CODE (expression) != TYPE_DECL, 20051116);
+
return (dependent_type_p (TREE_TYPE (expression)));
}
+2005-11-16 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c++/23797
+ Backport from mainline:
+ * g++.dg/parse/typename8.C: New test.
+ * g++.dg/parse/typename9.C: Likewise.
+
2005-11-15 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
Backport from mainline:
--- /dev/null
+// Copyright (C) 2005 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 12 Oct 2005 <nathan@codesourcery.com>
+
+// PR 23797:ICE
+// Origin: Volker Reichelt <reichelt@gcc.gnu.org>
+
+// { dg-options "-fpermissive -w" }
+
+struct A { typedef int X; };
+
+int i = typename A::X();
--- /dev/null
+struct A { typedef int X; };
+
+int i = typename A::X(); // { dg-error "typename" }