http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45894

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dodji at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-05 
12:50:15 UTC ---
Apparently lvalue_p is called on
 <baselink 0x7ffff1af4bd0
    type <lang_type 0x7ffff1accc78 unknown type type <lang_type 0x7ffff1accc78
unknown type>
        VOID
        align 1 symtab 0 alias set -1 canonical type 0x7ffff1accc78
        pointer_to_this <lang_type 0x7ffff1accc78 unknown type>
reference_to_this <lang_type 0x7ffff1accc78 unknown type>>

    functions <template_id_expr 0x7ffff7ffc188
        arg 0 <overload 0x7ffff1ae8720 type <lang_type 0x7ffff1accc78 unknown
type>
            function <template_decl 0x7ffff1aed228 bar>>>
    binfo <tree_binfo 0x7ffff1ae5360
        type <record_type 0x7ffff1add0a8 F type_5 type_6 QI
            size <integer_cst 0x7ffff1bdb4b0 constant 8>
            unit size <integer_cst 0x7ffff1bdb4d8 constant 1>
            align 8 symtab 0 alias set -1 canonical type 0x7ffff1add0a8 fields
<type_decl 0x7ffff1aed0b8 F> context <translation_unit_decl 0x7ffff1be7958 D.1>
            full-name "struct F"
            X() X(constX&) this=(X&) n_parents=0 use_template=0
interface-unknown
            pointer_to_this <pointer_type 0x7ffff1add498> chain <type_decl
0x7ffff1aed000 F>>
       > access_binfo <tree_binfo 0x7ffff1ae5360>>

which leads to lvalue_kind being called on the template_id_expr
(0x7ffff7ffc188 above) which has no type.

Can be fixed by making lvalue_kind more robust:
--- gcc/cp/tree.c.jj    2010-11-03 16:58:26.000000000 +0100
+++ gcc/cp/tree.c       2010-11-05 13:45:53.000000000 +0100
@@ -67,7 +67,8 @@ lvalue_kind (const_tree ref)
          == REFERENCE_TYPE)
     return lvalue_kind (TREE_OPERAND (ref, 0));

-  if (TREE_CODE (TREE_TYPE (ref)) == REFERENCE_TYPE)
+  if (TREE_TYPE (ref)
+      && TREE_CODE (TREE_TYPE (ref)) == REFERENCE_TYPE)
     {
       /* unnamed rvalue references are rvalues */
       if (TYPE_REF_IS_RVALUE (TREE_TYPE (ref))

but no idea whether that is the right thing to do.

Reply via email to