re PR c++/57183 ([C++11] auto and -Wunused-variable)
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 6 May 2013 16:40:24 +0000 (16:40 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 6 May 2013 16:40:24 +0000 (16:40 +0000)
/cp
2013-05-06  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/57183
* decl.c (cp_finish_decl): After do_auto_deduction copy the
qualifers with cp_apply_type_quals_to_decl.

/testsuite
2013-05-06  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/57183
* g++.dg/cpp0x/auto38.C: New.

From-SVN: r198636

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/auto38.C [new file with mode: 0644]

index e71b4f2025343caae8ce1dc86628cdf540ec2ccf..387f44aacf693334ae758cbfc09ed757f574387e 100644 (file)
@@ -1,3 +1,9 @@
+2013-05-06  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/57183
+       * decl.c (cp_finish_decl): After do_auto_deduction copy the
+       qualifers with cp_apply_type_quals_to_decl.
+
 2013-05-05  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * pt.c (convert_nontype_argument): Add missing whitespace in
index d92d334e1f5007ead34e8ad4c03a35a11402b9ef..12703d583dab9bfb9c96fb92534ad292f5b26b7d 100644 (file)
@@ -6147,6 +6147,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
                                                   auto_node);
       if (type == error_mark_node)
        return;
+      cp_apply_type_quals_to_decl (cp_type_quals (type), decl);
     }
 
   if (!ensure_literal_type_for_constexpr_object (decl))
index 1062a4ee2e5f8eb3d04f431f39ca85b74473130e..fb06bb164297493085560c8374630d45a1045121 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-06  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/57183
+       * g++.dg/cpp0x/auto38.C: New.
+
 2013-05-06  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/57185
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto38.C b/gcc/testsuite/g++.dg/cpp0x/auto38.C
new file mode 100644 (file)
index 0000000..070a39b
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/57183
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wunused-variable" }
+
+constexpr float PI_0 = 3.1415926F;
+constexpr auto PI_1 = 3.1415926F;
+const float PI_2 = 3.1415926F;
+const auto PI_3 = 3.1415926F;