re PR c++/51316 (alignof doesn't work with arrays of unknown bound)
/c-family 2011-12-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51316 * c-common.c (c_sizeof_or_alignof_type): In C++ allow for alignof of array types with an unknown bound. /testsuite 2011-12-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51316 * g++.dg/cpp0x/alignof4.C: New. From-SVN: r182746
This commit is contained in:
parent
30c34af582
commit
73ac190a5e
4 changed files with 29 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2011-12-30 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/51316
|
||||
* c-common.c (c_sizeof_or_alignof_type): In C++ allow for alignof
|
||||
of array types with an unknown bound.
|
||||
|
||||
2011-12-20 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* c-common.c (flag_isoc99): Update comment to refer to C11.
|
||||
|
|
|
@ -4382,13 +4382,22 @@ c_sizeof_or_alignof_type (location_t loc,
|
|||
return error_mark_node;
|
||||
value = size_one_node;
|
||||
}
|
||||
else if (!COMPLETE_TYPE_P (type))
|
||||
else if (!COMPLETE_TYPE_P (type)
|
||||
&& (!c_dialect_cxx () || is_sizeof || type_code != ARRAY_TYPE))
|
||||
{
|
||||
if (complain)
|
||||
error_at (loc, "invalid application of %qs to incomplete type %qT ",
|
||||
error_at (loc, "invalid application of %qs to incomplete type %qT",
|
||||
op_name, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
else if (c_dialect_cxx () && type_code == ARRAY_TYPE
|
||||
&& !COMPLETE_TYPE_P (TREE_TYPE (type)))
|
||||
{
|
||||
if (complain)
|
||||
error_at (loc, "invalid application of %qs to array type %qT of "
|
||||
"incomplete element type", op_name, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_sizeof)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2011-12-30 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/51316
|
||||
* g++.dg/cpp0x/alignof4.C: New.
|
||||
|
||||
2011-12-29 Michael Meissner <meissner@linux.vnet.ibm.com>
|
||||
|
||||
PR testsuite/51702
|
||||
|
|
7
gcc/testsuite/g++.dg/cpp0x/alignof4.C
Normal file
7
gcc/testsuite/g++.dg/cpp0x/alignof4.C
Normal file
|
@ -0,0 +1,7 @@
|
|||
// PR c++/51316
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
int main()
|
||||
{
|
||||
alignof(int []);
|
||||
}
|
Loading…
Add table
Reference in a new issue