[PATCH] D19175: Fix for PR27015 (variable template initialized with a generic lambda expression)

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 28 13:14:49 PDT 2016


ahatanak added a comment.

If I try calling Init(AnyParent, F) in Scope::setFlags, clang fails to compile the following code because it cannot find the definition of struct "foo":

  void foo3(void) 
    struct foo {
      int a, f;
    };
    char *np = nullptr;
    int *ip = &(((struct foo *)np)->f);
    *ip = 0;
  }

I can fix this test if I add a boolean flag to Scope::Init, which tells the function to return early before DeclsInScope and other fields are cleared.

All the other tests pass too except for test/CXX/drs/dr1xx.cpp:

  namespace dr183 { // dr183: sup 382
    template<typename T> struct A {};
    template<typename T> struct B {
      typedef int X;
    };
    template<> struct A<int> {
      typename B<int>::X x;
    };
  }

clang used to compile this code without any warnings or errors, but it now issues the following warning if -std=c++98 is on the command line:

dr1xx.cpp:7:5: warning: 'typename' occurs outside of a template [-Wc++11-extensions]

  typename B<int>::X x;
  ^~~~~~~~~

1 warning generated.

Is clang correct to issue the warning in this case?


http://reviews.llvm.org/D19175





More information about the cfe-commits mailing list