Commit 7d092805 by Paolo Carlini Committed by Paolo Carlini

re PR c++/51474 ([c++0x] ICE with pure virtual function in initialization of…

re PR c++/51474 ([c++0x] ICE with pure virtual function in initialization of non-static data member)

/cp
2014-03-19  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51474
	* call.c (build_new_method_call_1): Handle pure virtuals called by
	NSDMIs too.

/testsuite
2014-03-19  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51474
	* g++.dg/cpp0x/nsdmi-virtual2.C: New.

From-SVN: r208686
parent 057be77f
2014-03-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51474
* call.c (build_new_method_call_1): Handle pure virtuals called by
NSDMIs too.
2014-03-17 Adam Butcher <adam@jessamine.co.uk> 2014-03-17 Adam Butcher <adam@jessamine.co.uk>
PR c++/60390 PR c++/60390
......
...@@ -7828,15 +7828,20 @@ build_new_method_call_1 (tree instance, tree fns, vec<tree, va_gc> **args, ...@@ -7828,15 +7828,20 @@ build_new_method_call_1 (tree instance, tree fns, vec<tree, va_gc> **args,
if (!(flags & LOOKUP_NONVIRTUAL) if (!(flags & LOOKUP_NONVIRTUAL)
&& DECL_PURE_VIRTUAL_P (fn) && DECL_PURE_VIRTUAL_P (fn)
&& instance == current_class_ref && instance == current_class_ref
&& (DECL_CONSTRUCTOR_P (current_function_decl)
|| DECL_DESTRUCTOR_P (current_function_decl))
&& (complain & tf_warning)) && (complain & tf_warning))
/* This is not an error, it is runtime undefined {
behavior. */ /* This is not an error, it is runtime undefined
warning (0, (DECL_CONSTRUCTOR_P (current_function_decl) ? behavior. */
"pure virtual %q#D called from constructor" if (!current_function_decl)
: "pure virtual %q#D called from destructor"), warning (0, "pure virtual %q#D called from "
fn); "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 if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE
&& is_dummy_object (instance)) && is_dummy_object (instance))
......
2014-03-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51474
* g++.dg/cpp0x/nsdmi-virtual2.C: New.
2014-03-19 H.J. Lu <hongjiu.lu@intel.com> 2014-03-19 H.J. Lu <hongjiu.lu@intel.com>
PR testsuite/60590 PR testsuite/60590
......
// PR c++/51474
// { dg-do compile { target c++11 } }
struct A
{
virtual int foo() = 0;
int i = foo(); // { dg-warning "pure virtual" }
};
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