aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2014-03-19 18:21:52 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2014-03-19 18:21:52 +0000
commit7d092805ba995e042a89072bcbf2948800d87d3f (patch)
treeb4bc81b466dee6a514162c9420f227b15bfe340d /gcc/cp
parent057be77f433a256f6e8392f2e841d735d1ba6157 (diff)
downloadgcc-7d092805ba995e042a89072bcbf2948800d87d3f.zip
gcc-7d092805ba995e042a89072bcbf2948800d87d3f.tar.gz
gcc-7d092805ba995e042a89072bcbf2948800d87d3f.tar.bz2
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
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c21
2 files changed, 19 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3cf6858..655f6d4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+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>
PR c++/60390
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 184e922..877f6d9 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -7828,15 +7828,20 @@ build_new_method_call_1 (tree instance, tree fns, vec<tree, va_gc> **args,
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))