+2013-10-29 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58888
+ * decl2.c (grokfield): Handle auto like NSDMI.
+
2013-10-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58878
/* C++11 NSDMI, keep going. */;
else if (!VAR_P (value))
gcc_unreachable ();
- else if (!processing_template_decl)
- {
- if (TREE_CODE (init) == CONSTRUCTOR)
- init = digest_init (TREE_TYPE (value), init, tf_warning_or_error);
- init = maybe_constant_init (init);
-
- if (init != error_mark_node && !TREE_CONSTANT (init))
- {
- /* We can allow references to things that are effectively
- static, since references are initialized with the
- address. */
- if (TREE_CODE (TREE_TYPE (value)) != REFERENCE_TYPE
- || (TREE_STATIC (init) == 0
- && (!DECL_P (init) || DECL_EXTERNAL (init) == 0)))
- {
- error ("field initializer is not constant");
- init = error_mark_node;
- }
- }
- }
}
if (processing_template_decl && VAR_OR_FUNCTION_DECL_P (value))
+2013-10-29 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58888
+ * g++.dg/cpp0x/auto40.C: New.
+ * g++.dg/other/warning1.C: Adjust.
+
2013-10-29 Richard Biener <rguenther@suse.de>
* gcc.dg/torture/restrict-2.c: New testcase.
--- /dev/null
+// PR c++/58888
+// { dg-do compile { target c++11 } }
+
+#include <initializer_list>
+
+struct A
+{
+ static constexpr auto b{1.0};
+};
+
+constexpr decltype(A::b) A::b;
struct S
{
- static const float inf = 1.0f / 0.0f; // { dg-warning "1.0|float|initializ" }
- static const float nan = 0.0f / 0.0f; // { dg-warning "0.0|float|initializ" }
+ static const float inf = 1.0f / 0.0f; // { dg-error "1.0|float|initializ" }
+ static const float nan = 0.0f / 0.0f; // { dg-error "0.0|float|initializ" }
};
int main()