diff options
author | Mark Mitchell <mark@codesourcery.com> | 2003-09-02 20:54:07 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2003-09-02 20:54:07 +0000 |
commit | 3281be05bc239a26f314aca14e11ad139331ba8e (patch) | |
tree | 93cf7bb62c03e299a0938b5077fa67a29e16e087 /gcc/cp/pt.c | |
parent | 643845684253c6054a3990dd166d2b255abaa6e0 (diff) | |
download | gcc-3281be05bc239a26f314aca14e11ad139331ba8e.zip gcc-3281be05bc239a26f314aca14e11ad139331ba8e.tar.gz gcc-3281be05bc239a26f314aca14e11ad139331ba8e.tar.bz2 |
re PR c++/11847 (reference does not work as template argument any more)
PR c++/11847
* pt.c (convert_nontype_argument): Correct representation of
REFERENCE_TYPE expressions.
PR c++/11847
* g++.dg/template/class1.C: New test.
From-SVN: r71003
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ae47b60..f479901 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3209,9 +3209,12 @@ convert_nontype_argument (tree type, tree expr) tree type_referred_to = TREE_TYPE (type); /* If this expression already has reference type, get the - underling object. */ + underlying object. */ if (TREE_CODE (expr_type) == REFERENCE_TYPE) { + if (TREE_CODE (expr) == NOP_EXPR + && TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR) + STRIP_NOPS (expr); my_friendly_assert (TREE_CODE (expr) == ADDR_EXPR, 20000604); expr = TREE_OPERAND (expr, 0); expr_type = TREE_TYPE (expr); @@ -3265,7 +3268,7 @@ convert_nontype_argument (tree type, tree expr) } cxx_mark_addressable (expr); - return build1 (ADDR_EXPR, type, expr); + return build_nop (type, build_address (expr)); } break; |