[PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 3 12:20:42 PDT 2016


ahatanak added a comment.

OK, I'll add the test.

When I apply this patch and compile your test, I see DependentScopeDeclRefExpr gets converted to DeclRefExpr when the function is instantiated. This doesn't happen without this patch, but somehow clang still manages to emit the same code.

Also, Erik Pilkington pointed out that clang still crashes when it compiles the following code. I'm trying to figure out why that happens.

  // Template variable case:
  enum class foo { a, b };
  template <class T> auto a = [](foo f = foo::a) { return f; }();
  
  auto foo1() {
    return a<int>;
  }
  
  // Template struct case:
  template <class T> struct func {
    void bar() {
      enum class foo { a, b };
      [](foo f = foo::a) { return f; }();
    }
  };
  
  template struct func<int>;


https://reviews.llvm.org/D23096





More information about the cfe-commits mailing list