+2011-08-29 Jakub Jelinek <jakub@redhat.com>
+ Jason Merrill <jason@redhat.com>
+
+ PR c++/50207
+ * class.c (finish_struct_1): Complain if the first field is
+ artificial.
+
2011-08-29 Jason Merrill <jason@redhat.com>
PR c++/50209
/* Finish debugging output for this type. */
rest_of_type_compilation (t, ! LOCAL_CLASS_P (t));
- if (TYPE_TRANSPARENT_AGGR (t) && first_field (t) == NULL_TREE)
+ if (TYPE_TRANSPARENT_AGGR (t))
{
- error ("type transparent class %qT does not have any fields", t);
- TYPE_TRANSPARENT_AGGR (t) = 0;
+ tree field = first_field (t);
+ if (field == NULL_TREE || error_operand_p (field))
+ {
+ error ("type transparent class %qT does not have any fields", t);
+ TYPE_TRANSPARENT_AGGR (t) = 0;
+ }
+ else if (DECL_ARTIFICIAL (field))
+ {
+ if (DECL_FIELD_IS_BASE (field))
+ error ("type transparent class %qT has base classes", t);
+ else
+ {
+ gcc_checking_assert (DECL_VIRTUAL_P (field));
+ error ("type transparent class %qT has virtual functions", t);
+ }
+ TYPE_TRANSPARENT_AGGR (t) = 0;
+ }
}
}
+2011-08-29 Jakub Jelinek <jakub@redhat.com>
+ Jason Merrill <jason@redhat.com>
+
+ * g++.dg/dfp/base.C: New test.
+
2011-08-29 Jason Merrill <jason@redhat.com>
Core DR 994
--- /dev/null
+// PR c++/50207
+// { dg-do compile }
+
+namespace std
+{
+ namespace decimal
+ {
+ template <class _Fmt> struct _FmtTraits;
+ class decimal32;
+ template <> struct _FmtTraits <decimal32>
+ {
+ static const long _NumBytes = 4UL;
+ };
+ template <class _Tr> class _DecBase
+ {
+ unsigned char _Bytes[_Tr::_NumBytes];
+ };
+ class decimal32 : public _DecBase <_FmtTraits <decimal32> > // { dg-error "has base" }
+ {
+ decimal32 () { }
+ };
+ }
+}