+2003-11-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/12932
+ * class.c (currently_open_derived_class): Check if
+ current_class_type is NULL_TREE.
+ * semantics.c (finish_call_expr): Check if
+ currently_open_derived_class returns NULL_TREE.
+ * cp-tree.h (DERIVED_FROM_P): Add parenthesis around PARENT
+ parameter.
+
2003-11-17 Jason Merrill <jason@redhat.com>
* init.c (build_new_1): Preevaluate placement args.
if (dependent_type_p (t))
return NULL_TREE;
+ if (!current_class_type)
+ return NULL_TREE;
+
if (DERIVED_FROM_P (t, current_class_type))
return current_class_type;
/* Nonzero iff TYPE is derived from PARENT. Ignores accessibility and
ambiguity issues. */
#define DERIVED_FROM_P(PARENT, TYPE) \
- (lookup_base ((TYPE), PARENT, ba_any, NULL) != NULL_TREE)
+ (lookup_base ((TYPE), (PARENT), ba_any, NULL) != NULL_TREE)
/* Nonzero iff TYPE is uniquely derived from PARENT. Ignores
accessibility. */
#define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) \
if (DECL_FUNCTION_MEMBER_P (f))
{
tree type = currently_open_derived_class (DECL_CONTEXT (f));
+ if (!type)
+ type = DECL_CONTEXT (f);
fn = build_baselink (TYPE_BINFO (type),
TYPE_BINFO (type),
fn, /*optype=*/NULL_TREE);
+2003-11-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/12932
+ * g++.dg/template/static5.C: New test.
+
2003-11-18 Joseph S. Myers <jsm@polyomino.org.uk>
* gcc.dg/nested-func-1.c: New test.
--- /dev/null
+// { dg-do compile }
+
+// Origin: Mirek Fidler <cxl@ntllib.org>
+// Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+// PR c++/12932: ICE address of static function as template argument
+
+struct Test {
+ static void fun();
+};
+
+template <void (*fun)()>
+void foo () { (*fun)(); }
+
+
+template
+void foo<Test::fun> ();