summaryrefslogtreecommitdiff
path: root/gcc/cp/typeck.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-06 14:35:25 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-06 14:35:25 +0000
commit22bdb2aa647815e47c5947168cf36862b5fc5b87 (patch)
tree26a4afae364c992b478e346ca217b54552ba08ec /gcc/cp/typeck.c
parent13e140948339ad4bb2e4353c1d45102995191d75 (diff)
downloadgcc-22bdb2aa647815e47c5947168cf36862b5fc5b87.tar.gz
PR c++/45908
* typeck.c (cp_build_addr_expr_1): Add check for incomplete types in code folding offsetof-like computations. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165031 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/typeck.c')
-rw-r--r--gcc/cp/typeck.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index b2b8e5f5f78..ff5714ddb95 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4947,6 +4947,7 @@ cp_build_addr_expr_1 (tree arg, bool strict_lvalue, tsubst_flags_t complain)
&& TREE_CODE (argtype) != METHOD_TYPE
&& argtype != unknown_type_node
&& (val = get_base_address (arg))
+ && COMPLETE_TYPE_P (TREE_TYPE (val))
&& TREE_CODE (val) == INDIRECT_REF
&& TREE_CONSTANT (TREE_OPERAND (val, 0)))
{