Hi,

I just had a quick look to this PR, for:

template <class T>
class Foo
{
  bool m_barbar;

  void Bar()
  {
    auto bar = [this]() { if (!m_barbar) { } };
  }
};

we ICE as a Seg fault in lvalue_kind, at line # 147, because for ref we have an INDIRECT_REF with null TREE_TYPE:

    case INDIRECT_REF:
    case ARROW_EXPR:
    case ARRAY_REF:
    case PARM_DECL:
    case RESULT_DECL:
      if (TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)    // 147
    return clk_ordinary;
      break;

I noticed that elsewhere in the function we handle a null TREE_TYPE and I quickly tried the trivial attached patchlet which works for the testcase, in that lvalue_kind ends up simply returning clk_none. Does it make sense to you?

Thanks!
Paolo.

/////////////////
Index: tree.c
===================================================================
--- tree.c      (revision 191169)
+++ tree.c      (working copy)
@@ -144,7 +144,7 @@ lvalue_kind (const_tree ref)
     case ARRAY_REF:
     case PARM_DECL:
     case RESULT_DECL:
-      if (TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
+      if (TREE_TYPE (ref) && TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
        return clk_ordinary;
       break;
 

Reply via email to