diff options
author | Jason Merrill <jason@redhat.com> | 2011-07-01 09:36:17 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-07-01 09:36:17 -0400 |
commit | a174e38c098d49c437142b7a6d31f065a998d50c (patch) | |
tree | b1300337c37d69c95677c93bd9bcf8a32ac08320 /gcc/cp | |
parent | 6bbec3e1561a40c4b0870df42dbcbfc88be89dab (diff) | |
download | gcc-a174e38c098d49c437142b7a6d31f065a998d50c.zip gcc-a174e38c098d49c437142b7a6d31f065a998d50c.tar.gz gcc-a174e38c098d49c437142b7a6d31f065a998d50c.tar.bz2 |
re PR c++/49085 (Crash with SIGSEGV during compilation.)
PR c++/49085
* semantics.c (finish_offsetof): Complain about incomplete type.
From-SVN: r175758
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cc95078..842d049 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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> PR c++/49387 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index ad68a01..a704aa3 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -3422,6 +3422,12 @@ finish_offsetof (tree expr) } if (REFERENCE_REF_P (expr)) 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); } |