From edff0c0662c428774cdccdab4d1998e64ce8acf5 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 9 May 2015 20:47:33 -0400 Subject: [PATCH] c-opts.c (c_common_post_options): Also clear cpp_opts->cpp_warn_cxx11_compat. * c-opts.c (c_common_post_options): Also clear cpp_opts->cpp_warn_cxx11_compat. From-SVN: r222978 --- gcc/c-family/ChangeLog | 3 +++ gcc/c-family/c-opts.c | 1 + gcc/testsuite/g++.dg/cpp0x/bracket5.C | 6 ++++++ 3 files changed, 10 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/bracket5.C diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 568b2c60bf3..6169e521eda 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,5 +1,8 @@ 2015-05-09 Jason Merrill + * 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. diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index bd99871583b..e9eb511e8da 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -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 index 00000000000..22ac5445c55 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/bracket5.C @@ -0,0 +1,6 @@ +// { dg-options "-Wall" } +// { dg-do compile { target c++11 } } + +template struct X {}; +template struct Y { static int const c = 0; }; +int main() { return Y>::c; } -- 2.30.2