+2016-10-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/77948
+ * c.opt (fext-numeric-literals): Add Var and Init.
+ * c-opts.c (c_common_handle_option): Don't clear
+ cpp_opts->ext_numeric_literals for -std=c++{11,14,1z}.
+ (c_common_post_options): Clear it here if not set
+ explicitly.
+
2016-10-28 Aldy Hernandez <aldyh@redhat.com>
PR debug/77773
case OPT_std_c__11:
case OPT_std_gnu__11:
if (!preprocessing_asm_p)
- {
- set_std_cxx11 (code == OPT_std_c__11 /* ISO */);
- if (code == OPT_std_c__11)
- cpp_opts->ext_numeric_literals = 0;
- }
+ set_std_cxx11 (code == OPT_std_c__11 /* ISO */);
break;
case OPT_std_c__14:
case OPT_std_gnu__14:
if (!preprocessing_asm_p)
- {
- set_std_cxx14 (code == OPT_std_c__14 /* ISO */);
- if (code == OPT_std_c__14)
- cpp_opts->ext_numeric_literals = 0;
- }
+ set_std_cxx14 (code == OPT_std_c__14 /* ISO */);
break;
case OPT_std_c__1z:
case OPT_std_gnu__1z:
if (!preprocessing_asm_p)
- {
- set_std_cxx1z (code == OPT_std_c__1z /* ISO */);
- if (code == OPT_std_c__1z)
- cpp_opts->ext_numeric_literals = 0;
- }
+ set_std_cxx1z (code == OPT_std_c__1z /* ISO */);
break;
case OPT_std_c90:
if (warn_narrowing == -1)
warn_narrowing = 1;
+
+ /* Unless -f{,no-}ext-numeric-literals has been used explicitly,
+ for -std=c++{11,14,1z} default to -fno-ext-numeric-literals. */
+ if (flag_iso && !global_options_set.x_flag_ext_numeric_literals)
+ cpp_opts->ext_numeric_literals = 0;
}
else if (warn_narrowing == -1)
warn_narrowing = 0;
-femit-struct-debug-detailed=<spec-list> Detailed reduced debug info for structs.
fext-numeric-literals
-C++ ObjC++
+C++ ObjC++ Var(flag_ext_numeric_literals) Init(1)
Interpret imaginary, fixed-point, or other gnu number suffix as the corresponding
number literal rather than a user-defined number literal.
2016-10-31 Jakub Jelinek <jakub@redhat.com>
+ PR c++/77948
+ * g++.dg/cpp0x/pr77948-1.C: New test.
+ * g++.dg/cpp0x/pr77948-2.C: New test.
+ * g++.dg/cpp0x/pr77948-3.C: New test.
+ * g++.dg/cpp0x/pr77948-4.C: New test.
+ * g++.dg/cpp0x/pr77948-5.C: New test.
+ * g++.dg/cpp0x/pr77948-6.C: New test.
+
PR tree-optimization/77860
* gcc.dg/pr77860.c: New test.
--- /dev/null
+// PR c++/77948
+// { dg-do compile }
+// { dg-options "-std=c++11 -std=gnu++11" }
+
+void
+foo ()
+{
+ auto qfp = 1.0q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+ auto Qfp = 1.0Q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+}
--- /dev/null
+// PR c++/77948
+// { dg-do compile }
+// { dg-options "-std=gnu++11 -std=c++11" }
+
+void
+foo ()
+{
+ auto qfp = 1.0q; // { dg-error "unable to find numeric literal operator" }
+ auto Qfp = 1.0Q; // { dg-error "unable to find numeric literal operator" }
+}
--- /dev/null
+// PR c++/77948
+// { dg-do compile }
+// { dg-options "-std=c++11 -std=gnu++98" }
+
+void
+foo ()
+{
+ double qfp = 1.0q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+ double Qfp = 1.0Q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+}
--- /dev/null
+// PR c++/77948
+// { dg-do compile }
+// { dg-options "-std=c++11 -std=c++98" }
+
+void
+foo ()
+{
+ double qfp = 1.0q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+ double Qfp = 1.0Q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+}
--- /dev/null
+// PR c++/77948
+// { dg-do compile }
+// { dg-options "-std=gnu++98 -std=c++11" }
+
+void
+foo ()
+{
+ auto qfp = 1.0q; // { dg-error "unable to find numeric literal operator" }
+ auto Qfp = 1.0Q; // { dg-error "unable to find numeric literal operator" }
+}
--- /dev/null
+// PR c++/77948
+// { dg-do compile }
+// { dg-options "-std=c++98 -std=c++11" }
+
+void
+foo ()
+{
+ auto qfp = 1.0q; // { dg-error "unable to find numeric literal operator" }
+ auto Qfp = 1.0Q; // { dg-error "unable to find numeric literal operator" }
+}