PR c++/81359 - Unparsed NSDMI error from SFINAE context.
authorJason Merrill <jason@redhat.com>
Thu, 10 Aug 2017 19:55:48 +0000 (15:55 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 10 Aug 2017 19:55:48 +0000 (15:55 -0400)
* method.c (synthesized_method_walk): Don't diagnose lack of
operator delete.

From-SVN: r251036

gcc/cp/ChangeLog
gcc/cp/method.c
gcc/testsuite/g++.dg/inherit/vdtor1.C [new file with mode: 0644]

index bc4eaa20b46feb7d94de8ae8ed46ddb3bca2e225..792a42ad14adf47a46bb12bb23f46ca07fba214d 100644 (file)
@@ -1,5 +1,9 @@
 2017-08-10  Jason Merrill  <jason@redhat.com>
 
+       PR c++/81359 - Unparsed NSDMI error from SFINAE context.
+       * method.c (synthesized_method_walk): Don't diagnose lack of
+       operator delete.
+
        PR c++/80452 - Core 1579, implicit move semantics on return/throw
        * cp-tree.h (LOOKUP_PREFER_RVALUE): Now means that we've already
        tentatively changed the lvalue to an rvalue.
index bff960513c0c9de3be9468d49a242b242723e84d..809ebc8311c738c63ebcc14936495cb4f6cd652a 100644 (file)
@@ -1693,12 +1693,18 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
 
       if (check_vdtor && type_has_virtual_destructor (BINFO_TYPE (base_binfo)))
        {
-         fn = locate_fn_flags (ctype, cp_operator_id (DELETE_EXPR),
-                               ptr_type_node, flags, complain);
          /* Unlike for base ctor/op=/dtor, for operator delete it's fine
             to have a null fn (no class-specific op delete).  */
-         if (fn && fn == error_mark_node && deleted_p)
-           *deleted_p = true;
+         fn = locate_fn_flags (ctype, cp_operator_id (DELETE_EXPR),
+                               ptr_type_node, flags, tf_none);
+         if (fn && fn == error_mark_node)
+           {
+             if (complain & tf_error)
+               locate_fn_flags (ctype, cp_operator_id (DELETE_EXPR),
+                                ptr_type_node, flags, complain);
+             if (deleted_p)
+               *deleted_p = true;
+           }
          check_vdtor = false;
        }
     }
diff --git a/gcc/testsuite/g++.dg/inherit/vdtor1.C b/gcc/testsuite/g++.dg/inherit/vdtor1.C
new file mode 100644 (file)
index 0000000..caba17f
--- /dev/null
@@ -0,0 +1,7 @@
+struct A {
+  void operator delete(void *, unsigned long);
+};
+struct B : A {
+  virtual ~B();
+};
+struct C : B {};