diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-04-03 09:43:46 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-04-03 09:43:46 +0200 |
commit | 60c4d1358ad5e944caeb1a335da0b2703d909670 (patch) | |
tree | 05c057f129b8e304ff878651261f0fb4016c5d77 /gcc/cp | |
parent | 6cba282a2ceb2086f207124388bc2c38088d759b (diff) | |
download | gcc-60c4d1358ad5e944caeb1a335da0b2703d909670.zip gcc-60c4d1358ad5e944caeb1a335da0b2703d909670.tar.gz gcc-60c4d1358ad5e944caeb1a335da0b2703d909670.tar.bz2 |
re PR c++/35741 (ICE with offsetof and references)
PR c++/35741
* semantics.c (finish_offsetof): Undo effect of convert_from_reference
before calling fold_offsetof.
* g++.dg/other/offsetof5.C: New test.
From-SVN: r133863
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c7600ec..713b62e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-04-03 Jakub Jelinek <jakub@redhat.com> + + PR c++/35741 + * semantics.c (finish_offsetof): Undo effect of convert_from_reference + before calling fold_offsetof. + 2008-04-03 Tom Tromey <tromey@redhat.com> * Make-lang.in (c++_OBJS): New variable. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 8966bf5..95ebde6 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -3039,6 +3039,8 @@ finish_offsetof (tree expr) error ("cannot apply %<offsetof%> to member function %qD", expr); return error_mark_node; } + if (TREE_CODE (expr) == INDIRECT_REF && REFERENCE_REF_P (expr)) + expr = TREE_OPERAND (expr, 0); return fold_offsetof (expr, NULL_TREE); } |