+2004-11-12 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/18389
+ * decl.c (start_decl): Make sure to set *pop_scope_p. Return
+ error_mark_node to indicate errors.
+
+ PR c++/18429
+ * parser.c (cp_parser_direct_declarator): Disallow non-constant
+ array bounds when not inside a function.
+
+ PR c++/18436
+ * pt.c (tsubst_copy_and_build): Do not do Koenig lookup when an
+ unqualified name resolves to a member function.
+
+ PR c++/18407
+ * pt.c (tsubst_copy_and_build): Handle qualified names used from a
+ derived class correctly.
+
+ * decl2.c (import_export_decl): Fix typo in comment.
+ * tree.c (pod_type_p): Likewise.
+
2004-11-10 Andrew Pinski <pinskia@physics.uc.edu>
* typeck.c (cxx_mark_addressable): Add braces around the first if.
tree type, tem;
tree context;
+ *pop_scope_p = false;
+
/* This should only be done once on the top most decl. */
if (have_extern_spec)
{
deprecated_state = DEPRECATED_NORMAL;
if (decl == NULL_TREE || TREE_CODE (decl) == VOID_TYPE)
- return NULL_TREE;
+ return error_mark_node;
type = TREE_TYPE (decl);
if (type == error_mark_node)
- return NULL_TREE;
+ return error_mark_node;
context = DECL_CONTEXT (decl);
if (context)
*pop_scope_p = push_scope (context);
- else
- *pop_scope_p = false;
/* We are only interested in class contexts, later. */
if (context && TREE_CODE (context) == NAMESPACE_DECL)
vague linkage, maybe_commonize_var is used.
Therefore, the only declarations that should be provided to this
- function are those with external linkage that:
+ function are those with external linkage that are:
* implicit instantiations of function templates
&non_constant_p);
if (!non_constant_p)
bounds = fold_non_dependent_expr (bounds);
+ else if (!at_function_scope_p ())
+ {
+ error ("array bound is not an integer constant");
+ bounds = error_mark_node;
+ }
}
else
bounds = NULL_TREE;
lookup finds a non-function, in accordance with the
expected resolution of DR 218. */
if (koenig_p
- && (is_overloaded_fn (function)
+ && ((is_overloaded_fn (function)
+ /* If lookup found a member function, the Koenig lookup is
+ not appropriate, even if an unqualified-name was used
+ to denote the function. */
+ && !DECL_FUNCTION_MEMBER_P (get_first_fn (function)))
|| TREE_CODE (function) == IDENTIFIER_NODE))
function = perform_koenig_lookup (function, call_args);
/*is_type_p=*/false,
/*complain=*/false);
if (BASELINK_P (member))
- BASELINK_FUNCTIONS (member)
- = build_nt (TEMPLATE_ID_EXPR, BASELINK_FUNCTIONS (member),
- args);
+ {
+ BASELINK_FUNCTIONS (member)
+ = build_nt (TEMPLATE_ID_EXPR, BASELINK_FUNCTIONS (member),
+ args);
+ member = (adjust_result_of_qualified_name_lookup
+ (member, BINFO_TYPE (BASELINK_BINFO (member)),
+ TREE_TYPE (object)));
+ }
else
{
qualified_name_lookup_error (TREE_TYPE (object), tmpl,
return 1; /* pointer to member */
if (TREE_CODE (t) == VECTOR_TYPE)
- return 1; /* vectors are (small) arrays if scalars */
+ return 1; /* vectors are (small) arrays of scalars */
if (! CLASS_TYPE_P (t))
return 0; /* other non-class type (reference or function) */
+2004-11-12 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/18389
+ * g++.dg/parse/cond1.C: New test.
+
+ PR c++/18429
+ * g++.dg/template/array9.C: New test.
+ * g++.dg/ext/vla1.C: Adjust error messages.
+ * g++.dg/ext/vlm1.C: Likewise.
+ * g++.dg/template/crash2.C: Likewise.
+
+ PR c++/18436
+ * g++.dg/template/call3.C: New test.
+
+ PR c++/18407
+ * g++.dg/template/ptrmem11.C: New test.
+
2004-11-12 Andrew Pinski <pinskia@physics.uc.edu>
PR other/14264
B::B (int i)
{
struct S {
- int ar[1][i]; // { dg-error "variable-size|variably modified" }
+ int ar[1][i]; // { dg-error "array" }
} s;
s.ar[0][0] = 0; // { dg-error "no member" }
struct B {
static const int s;
- A<int[s]> a; // { dg-error "variably modified|no type|trying to instantiate" }
+ A<int[s]> a; // { dg-error "array|template" }
};
const int B::s=16;
--- /dev/null
+// PR c++/18389
+
+void foo()
+{
+ for (; struct A {}; ); // { dg-error "" }
+}
--- /dev/null
+// PR c++/18429
+
+int subtrees = 4;
+template< class T >
+struct Tree {
+ Tree* L[subtrees]; // { dg-error "" }
+ Tree* R[subtrees]; // { dg-error "" }
+ ~Tree()
+ {
+ delete [] L[0]; // { dg-error "" }
+ delete [] R[0]; // { dg-error "" }
+ }
+};
+
+void f()
+{
+ Tree<int> t;
+}
--- /dev/null
+// PR c++/18436
+
+void foo(int);
+
+struct A
+{
+ static void foo(A);
+};
+
+template <typename T> struct B : T
+{
+ B() { foo(T()); }
+};
+
+B<A> b;
{
public:
static const EnumType size = max; // { dg-error "" }
- int table[size];
+ int table[size]; // { dg-error "" }
};
template <class EnumType>
const EnumType A<EnumType>::size;
--- /dev/null
+// PR c++/18407
+
+template <typename Class>
+struct the_base{
+ template <void (Class::*Fn)()> void foo() { }
+};
+
+template <typename T>
+struct derivedT: the_base<derivedT<T> > {
+ typedef the_base<derivedT<T> > parent;
+ void ice(){
+ this->parent::template foo< &derivedT<T>::ice>();
+ }
+};
+
+int main() {
+ derivedT<int> dT;
+ dT.ice();
+}