Commit bfcbe068 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/46862 (ICE on std::decimal::decimal32 without any fields)

	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.

	* g++.dg/dfp/nofields.C: New test.

From-SVN: r177987
parent 02f5d6c5
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> 2011-08-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Marc Glisse <marc.glisse@normalesup.org> Marc Glisse <marc.glisse@normalesup.org>
......
/* Functions related to building classes and their related objects. /* Functions related to building classes and their related objects.
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 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. Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) Contributed by Michael Tiemann (tiemann@cygnus.com)
...@@ -5794,6 +5794,12 @@ finish_struct_1 (tree t) ...@@ -5794,6 +5794,12 @@ finish_struct_1 (tree t)
/* Finish debugging output for this type. */ /* Finish debugging output for this type. */
rest_of_type_compilation (t, ! LOCAL_CLASS_P (t)); 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 /* When T was built up, the member declarations were added in reverse
......
2011-08-23 Jakub Jelinek <jakub@redhat.com>
PR c++/46862
* g++.dg/dfp/nofields.C: New test.
2011-08-23 Tobias Burnus <burnus@net-b.de> 2011-08-23 Tobias Burnus <burnus@net-b.de>
PR fortran/31600 PR fortran/31600
......
// 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)
{
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment