+2019-01-27 Marek Polacek <polacek@redhat.com>
+
+ PR c++/89024 - ICE with incomplete enum type.
+ * call.c (standard_conversion): When converting an
+ ARITHMETIC_TYPE_P to an incomplete type, return NULL.
+
2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/88969
|| (fcode == REAL_TYPE && !(flags & LOOKUP_NO_NON_INTEGRAL)))
|| SCOPED_ENUM_P (from))
return NULL;
+
+ /* If we're parsing an enum with no fixed underlying type, we're
+ dealing with an incomplete type, which renders the conversion
+ ill-formed. */
+ if (!COMPLETE_TYPE_P (from))
+ return NULL;
+
conv = build_conv (ck_std, to, conv);
/* Give this a better rank if it's a promotion. */
+2019-01-27 Marek Polacek <polacek@redhat.com>
+
+ PR c++/89024 - ICE with incomplete enum type.
+ * g++.dg/cpp0x/enum37.C: New test.
+
2019-01-27 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/opt75.adb: New test.
--- /dev/null
+// PR c++/89024
+// { dg-do compile { target c++11 } }
+
+template <class T, class U> struct same;
+template <class T> struct same<T,T> {};
+
+template<class T> T&& declval();
+
+template<typename _To1>
+void __test_aux(_To1);
+
+template<typename _From1, typename _To1,
+ typename = decltype(__test_aux<_To1>(declval<_From1>()))>
+char __test(int);
+
+template<typename, typename>
+int __test(...);
+
+enum E {
+ x = decltype(__test<E, int>(0))(0)
+};
+
+same<E,decltype(x)> s;
+same<unsigned int,__underlying_type(E)> s2;