+2011-08-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/46862
+ * class.c (finish_struct_1): If TYPE_TRANSPARENT_AGGR is set on a type
+ which doesn't have any fields, clear it and diagnose.
+
2011-08-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Marc Glisse <marc.glisse@normalesup.org>
/* Functions related to building classes and their related objects.
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
/* 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)
+ {
+ error ("type transparent class %qT does not have any fields", t);
+ TYPE_TRANSPARENT_AGGR (t) = 0;
+ }
}
/* When T was built up, the member declarations were added in reverse
--- /dev/null
+// PR c++/46862
+// { dg-do compile }
+
+namespace std
+{
+ namespace decimal
+ {
+ class decimal32 { }; // { dg-error "does not have any fields" }
+ class decimal64 { }; // { dg-error "does not have any fields" }
+ class decimal128 { }; // { dg-error "does not have any fields" }
+ }
+}
+
+void
+foo (std::decimal::decimal32 x,
+ std::decimal::decimal64 y,
+ std::decimal::decimal128 z)
+{
+}