mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/49085 (Crash with SIGSEGV during compilation.)
PR c++/49085 * semantics.c (finish_offsetof): Complain about incomplete type. From-SVN: r175758
This commit is contained in:
parent
6bbec3e156
commit
a174e38c09
|
@ -1,3 +1,8 @@
|
||||||
|
2011-07-01 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/49085
|
||||||
|
* semantics.c (finish_offsetof): Complain about incomplete type.
|
||||||
|
|
||||||
2011-06-30 Jason Merrill <jason@redhat.com>
|
2011-06-30 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
PR c++/49387
|
PR c++/49387
|
||||||
|
|
|
@ -3422,6 +3422,12 @@ finish_offsetof (tree expr)
|
||||||
}
|
}
|
||||||
if (REFERENCE_REF_P (expr))
|
if (REFERENCE_REF_P (expr))
|
||||||
expr = TREE_OPERAND (expr, 0);
|
expr = TREE_OPERAND (expr, 0);
|
||||||
|
if (TREE_CODE (expr) == COMPONENT_REF)
|
||||||
|
{
|
||||||
|
tree object = TREE_OPERAND (expr, 0);
|
||||||
|
if (!complete_type_or_else (TREE_TYPE (object), object))
|
||||||
|
return error_mark_node;
|
||||||
|
}
|
||||||
return fold_offsetof (expr, NULL_TREE);
|
return fold_offsetof (expr, NULL_TREE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2011-07-01 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/49085
|
||||||
|
* g++.dg/template/offsetof2.C: New.
|
||||||
|
|
||||||
2011-07-01 Kai Tietz <ktietz@redhat.com>
|
2011-07-01 Kai Tietz <ktietz@redhat.com>
|
||||||
|
|
||||||
* gcc.dg/tree-ssa/bitwise-sink.c: New test.
|
* gcc.dg/tree-ssa/bitwise-sink.c: New test.
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
// PR c++/49085
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct A // { dg-error "declaration" }
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
int ar[__builtin_offsetof(A,j)]; // { dg-error "incomplete type" }
|
||||||
|
};
|
||||||
|
|
||||||
|
A<int> a;
|
Loading…
Reference in New Issue