<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Apr 28, 2016 at 1:14 PM, Akira Hatanaka via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">ahatanak added a comment.<br>
<br>
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":<br>
<br>
  void foo3(void)<br>
    struct foo {<br>
      int a, f;<br>
    };<br>
    char *np = nullptr;<br>
    int *ip = &(((struct foo *)np)->f);<br>
    *ip = 0;<br>
  }<br>
<br>
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.<br></blockquote><div><br></div><div>Instead of adding the bool parameter to `Init`, how about this: move `setFlags` out of line, move the parts of `Init` that compute things based on the flags into `setFlags`, and call `setFlags` from `Init`.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
All the other tests pass too except for test/CXX/drs/dr1xx.cpp:<br>
<br>
  namespace dr183 { // dr183: sup 382<br>
    template<typename T> struct A {};<br>
    template<typename T> struct B {<br>
      typedef int X;<br>
    };<br>
    template<> struct A<int> {<br>
      typename B<int>::X x;<br>
    };<br>
  }<br>
<br>
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:<br>
<br>
dr1xx.cpp:7:5: warning: 'typename' occurs outside of a template [-Wc++11-extensions]<br>
<br>
  typename B<int>::X x;<br>
  ^~~~~~~~~<br>
<br>
1 warning generated.<br>
<br>
Is clang correct to issue the warning in this case?</blockquote><div><br></div><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
<a href="http://reviews.llvm.org/D19175" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19175</a><br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>