/usr/src/gcc-4.8/debian/patches/pr57211.diff is in gcc-4.8-source 4.8.2-19ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | # DP: Fix PR c++/57211, don't warn about unused parameters of defaulted functions.
/cp
2013-05-22 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57211
* method.c (defaultable_fn_check): Avoid do_warn_unused_parameter
warnings about defaulted functions.
/testsuite
2013-05-22 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57211
* g++.dg/cpp0x/Wunused-parm.C: New.
Index: b/src/gcc/cp/method.c
===================================================================
--- a/src/gcc/cp/method.c
+++ b/src/gcc/cp/method.c
@@ -1841,13 +1841,19 @@
}
else
{
- tree t = FUNCTION_FIRST_USER_PARMTYPE (fn);
- for (; t && t != void_list_node; t = TREE_CHAIN (t))
+ for (tree t = FUNCTION_FIRST_USER_PARMTYPE (fn);
+ t && t != void_list_node; t = TREE_CHAIN (t))
if (TREE_PURPOSE (t))
{
error ("defaulted function %q+D with default argument", fn);
break;
}
+
+ /* Avoid do_warn_unused_parameter warnings. */
+ for (tree p = FUNCTION_FIRST_USER_PARM (fn); p; p = DECL_CHAIN (p))
+ if (DECL_NAME (p))
+ TREE_NO_WARNING (p) = 1;
+
if (TYPE_BEING_DEFINED (DECL_CONTEXT (fn)))
/* Defer checking. */;
else if (!processing_template_decl)
Index: b/src/gcc/testsuite/g++.dg/cpp0x/Wunused-parm.C
===================================================================
--- /dev/null
+++ b/src/gcc/testsuite/g++.dg/cpp0x/Wunused-parm.C
@@ -0,0 +1,23 @@
+// PR c++/57211
+// { dg-options "-std=c++11 -Wunused-parameter" }
+
+template <class T> T&& move(T&);
+
+struct A
+{
+ struct B
+ {
+ B& operator=(B&&);
+ };
+
+ B f;
+
+ A& operator=(A&& p) = default;
+};
+
+int main()
+{
+ A a;
+ A b;
+ b = move(a);
+}
|