aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/expr.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-03-20 23:25:35 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-03-20 23:25:35 -0400
commitdeaae9d7c73f87cfd2a0125411fdc54824b5d410 (patch)
tree875a9ad5038acb1c7903c9adf6be0a805d2de46e /gcc/cp/expr.c
parent766053b33a997fb268791967df46c5c3f9f94a64 (diff)
downloadgcc-deaae9d7c73f87cfd2a0125411fdc54824b5d410.zip
gcc-deaae9d7c73f87cfd2a0125411fdc54824b5d410.tar.gz
gcc-deaae9d7c73f87cfd2a0125411fdc54824b5d410.tar.bz2
re PR c++/54532 ([C++0x][constexpr] internal error when initializing static constexpr with pointer to non-static member variable)
PR c++/54532 * expr.c (cplus_expand_constant): Do nothing if the class is incomplete. * semantics.c (reduced_constant_expression_p): Allow PTRMEM_CST. * typeck2.c (store_init_value): Use reduced_constant_expression_p. * decl.c (maybe_register_incomplete_var): Handle PTRMEM_CST. (complete_vars): Likewise. From-SVN: r196852
Diffstat (limited to 'gcc/cp/expr.c')
-rw-r--r--gcc/cp/expr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c
index ffd18ca..f15b049 100644
--- a/gcc/cp/expr.c
+++ b/gcc/cp/expr.c
@@ -43,6 +43,10 @@ cplus_expand_constant (tree cst)
/* Find the member. */
member = PTRMEM_CST_MEMBER (cst);
+ /* We can't lower this until the class is complete. */
+ if (!COMPLETE_TYPE_P (DECL_CONTEXT (member)))
+ return cst;
+
if (TREE_CODE (member) == FIELD_DECL)
{
/* Find the offset for the field. */