]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-opts.c (c_common_post_options): Also clear cpp_opts->cpp_warn_cxx11_compat.
authorJason Merrill <jason@redhat.com>
Sun, 10 May 2015 00:47:33 +0000 (20:47 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sun, 10 May 2015 00:47:33 +0000 (20:47 -0400)
* c-opts.c (c_common_post_options): Also clear
cpp_opts->cpp_warn_cxx11_compat.

From-SVN: r222978

gcc/c-family/ChangeLog
gcc/c-family/c-opts.c
gcc/testsuite/g++.dg/cpp0x/bracket5.C [new file with mode: 0644]

index 568b2c60bf3a7029be27ed3bb7353095c0fc439a..6169e521edaab68a80fe4a3ba4e56e9c23176c36 100644 (file)
@@ -1,5 +1,8 @@
 2015-05-09  Jason Merrill  <jason@redhat.com>
 
+       * c-opts.c (c_common_post_options): Also clear
+       cpp_opts->cpp_warn_cxx11_compat.
+
        * c-common.h (enum cxx_dialect): Add cxx_unset.
        * c-common.c (cxx_dialect): Initialize to cxx_unset.
        * c-opts.c (c_common_post_options): Set C++ dialect to C++98 if unset.
index bd99871583b6d9ae0d71478f936c533d7d4562e8..e9eb511e8dab39e5f7446c1fa5eb70d252eaef4b 100644 (file)
@@ -905,6 +905,7 @@ c_common_post_options (const char **pfilename)
       /* If we're allowing C++0x constructs, don't warn about C++98
         identifiers which are keywords in C++0x.  */
       warn_cxx11_compat = 0;
+      cpp_opts->cpp_warn_cxx11_compat = 0;
 
       if (warn_narrowing == -1)
        warn_narrowing = 1;
diff --git a/gcc/testsuite/g++.dg/cpp0x/bracket5.C b/gcc/testsuite/g++.dg/cpp0x/bracket5.C
new file mode 100644 (file)
index 0000000..22ac544
--- /dev/null
@@ -0,0 +1,6 @@
+// { dg-options "-Wall" }
+// { dg-do compile { target c++11 } }
+
+template <int> struct X {};
+template <typename> struct Y { static int const c = 0; };
+int main() { return Y<X<1>>::c; }