if (!(flags & LOOKUP_NONVIRTUAL)
&& DECL_PURE_VIRTUAL_P (fn)
&& instance == current_class_ref
- && (DECL_CONSTRUCTOR_P (current_function_decl)
- || DECL_DESTRUCTOR_P (current_function_decl))
&& (complain & tf_warning))
- /* This is not an error, it is runtime undefined
- behavior. */
- warning (0, (DECL_CONSTRUCTOR_P (current_function_decl) ?
- "pure virtual %q#D called from constructor"
- : "pure virtual %q#D called from destructor"),
- fn);
+ {
+ /* This is not an error, it is runtime undefined
+ behavior. */
+ if (!current_function_decl)
+ warning (0, "pure virtual %q#D called from "
+ "non-static data member initializer", fn);
+ else if (DECL_CONSTRUCTOR_P (current_function_decl)
+ || DECL_DESTRUCTOR_P (current_function_decl))
+ warning (0, (DECL_CONSTRUCTOR_P (current_function_decl)
+ ? "pure virtual %q#D called from constructor"
+ : "pure virtual %q#D called from destructor"),
+ fn);
+ }
if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE
&& is_dummy_object (instance))