Hello! Revision 4 uploaded.<div><a href="http://llvm.org/bugs/attachment.cgi?id=9603&action=diff">http://llvm.org/bugs/attachment.cgi?id=9603&action=diff</a><br><br><div class="gmail_quote">2012/11/28 Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div class="im">On Tue, Nov 27, 2012 at 11:29 PM, WenHan Gu (¨¦¨Z¿«) <span dir="ltr"><<a href="mailto:wenhan.gu@gmail.com" target="_blank">wenhan.gu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Wrong file, sorry.<div><a href="http://llvm.org/bugs/attachment.cgi?id=9602&action=diff" target="_blank">http://llvm.org/bugs/attachment.cgi?id=9602&action=diff</a></div></blockquote><div><br></div></div><div>Thanks!<div>

<br></div><div><div>+/// @param[in,out] T  It will be decayed to a pointer automatically when input</div><div><br></div><div>Please use \param, not @param, to match the prevailing style in Clang.</div><div><br></div><div>

<div>   // C++ 15.4p2: A type denoted in an exception-specification shall not denote</div><div>   //   an incomplete type.</div><div>-  if (RequireCompleteType(Range.getBegin(), T,</div><div>+  if (!T->isArrayType() && !T->isFunctionType() &&</div>

<div>+      RequireCompleteType(Range.getBegin(), T,</div><div>                           diag::err_incomplete_in_exception_spec,</div><div>                           /*direct*/0, Range))</div><div>     return true;</div>

<div> </div><div>+  if (T->isArrayType())</div><div>+    T = Context.getArrayDecayedType(T);</div><div>+  else if (T->isFunctionType())</div><div>+    T = Context.getPointerType(T);</div></div><div><br></div><div>Maybe move this before the RequireCompleteType call, and make the RequireCompleteType the 'else' for these? It'd also be nice to reference the relevant paragraph in the standard here.</div>
</div></div></div></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="gmail_quote"><div><div>
<br></div></div><div><div>--- a/test/SemaCXX/exception-spec-decay.cpp<span style="white-space:pre-wrap">  </span></div><div>+++ a/test/SemaCXX/exception-spec-decay.cpp<span style="white-space:pre-wrap">      </span></div>
<div>@@ -0,0 +1,33 @@ </div><div>+// RUN: %clang -x c++ -fexceptions -emit-llvm -S -o - %s | FileCheck %s</div></div><div><br></div><div>Please put this test in test/CodeGenCXX/, use %clang_cc1, and specify a -triple.</div>

<div> </div><div><div>+    // CHECK-next: _ZTIPi</div></div><div><br></div><div>Use "CHECK-NEXT:". FileCheck will ignore this line.</div><div><br></div><div>A -fsyntax-only test would be useful. Something like:</div>
</div></blockquote><div><br></div><div>I think checking mangled type string is more clear. Isn't it?</div><div>Therefore, I move it into CodeGenCXX. Thanks!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote">
<div><br></div><div>void f() throw(int*, int());</div><div>void f() throw(int[], int(*)());</div><div><div class="h5"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Thanks.</div>
<div><br><div class="gmail_quote">
2012/11/28 WenHan Gu (¨¦¨Z¿«) <span dir="ltr"><<a href="mailto:wenhan.gu@gmail.com" target="_blank">wenhan.gu@gmail.com</a>></span><div><div><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Hi Richard,<div><br></div><div>I've revised it again. I think this time all similar cases can run.</div><div>Please have a look.</div><div><a href="http://llvm.org/bugs/attachment.cgi?id=9601&action=diff" target="_blank">http://llvm.org/bugs/attachment.cgi?id=9601&action=diff</a></div>



<div>PR14388: <a href="http://llvm.org/bugs/show_bug.cgi?id=14388" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=14388</a></div><div><br></div><div>Thanks!<div><div><br><br><div class="gmail_quote">2012/11/22 Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span><br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<div><br>
On Wed, Nov 21, 2012 at 11:58 PM, WenHan Gu (¨¦¨Z¿«) <<a href="mailto:wenhan.gu@gmail.com" target="_blank">wenhan.gu@gmail.com</a>> wrote:<br>
> Hi Richard,<br>
><br>
</div><div>> You're right. I've revised the patch.<br>
> Patch url: <a href="http://llvm.org/bugs/attachment.cgi?id=9583" target="_blank">http://llvm.org/bugs/attachment.cgi?id=9583</a><br>
> (Sorry that my environment cannot upload it to GMail)<br>
><br>
> I didn't put the logic inside CheckSpecifiedExceptionType, since the<br>
> QualType is pass-by-value, instead, I found I should put it before it.<br>
> I also made a test case.<br>
<br>
</div>This still needs changes to handle the template instantiation case<br>
(the other caller of CheckSpecifiedExceptionType):<br>
<br>
template<typename T> struct S {<br>
  void f() throw(T);<br>
};<br>
S<int[10]> s;<br>
<div><div><br>
> 2012/11/21 Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>><br>
>><br>
>> On Tue, Nov 20, 2012 at 7:20 PM, WenHan Gu (¨¦¨Z¿«) <<a href="mailto:wenhan.gu@gmail.com" target="_blank">wenhan.gu@gmail.com</a>><br>
>> wrote:<br>
>> > Hi Richard,<br>
>> > Thanks your comments.<br>
>> ><br>
>> > However, I have no idea whether I should do this patch.<br>
>> > I've tested by gcc, clang and searched C++ spec draft n3242, the result<br>
>> > is<br>
>> > that both GCC and Clang failed on that and I cannot find any wording on<br>
>> > this<br>
>> > issue.<br>
>><br>
>> I suggest you switch to using n3485.<br>
>><br>
>> 15.4/2:<br>
>><br>
>> A type denoted in an exception-specification shall not denote an<br>
>> incomplete type other than a class<br>
>> currently being defined or an rvalue reference type. A type denoted in<br>
>> an exception-specification shall not<br>
>> denote a pointer or reference to an incomplete type, other than cv<br>
>> void* or a pointer or reference to a<br>
>> class currently being defined. A type cv T, “array of T”, or “function<br>
>> returning T” denoted in an exception-<br>
>> specification is adjusted to type T, “pointer to T”, or “pointer to<br>
>> function returning T”, respectively.<br>
>><br>
>> We are supposed to apply the decay from S[10] to S* before we check<br>
>> whether it's an incomplete-or-being-defined type or a pointer to an<br>
>> incomplete-or-being-defined type, so S[10] is OK.<br>
>><br>
>> > Could you teach me more or could some else help?<br>
>> > Thanks!<br>
>> ><br>
>> >   1 struct S {<br>
>> >   2   void foo() throw (S[10])  { throw 0; }  // Both gcc and clang<br>
>> > failed<br>
>> > on this function<br>
>> >   3   void bar() throw (S)  { throw 0; }<br>
>> >   4 };<br>
>> >   5<br>
>> >   6 int main() {<br>
>> >   7   S().foo();<br>
>> >   8   S().bar();<br>
>> >   9 }<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > 2012/11/21 Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>><br>
>> >><br>
>> >> Hi,<br>
>> >><br>
>> >> On Tue, Nov 20, 2012 at 1:54 AM, WenHan Gu (¨¦¨Z¿«) <<a href="mailto:wenhan.gu@gmail.com" target="_blank">wenhan.gu@gmail.com</a>><br>
>> >> wrote:<br>
>> >> > Hi all,<br>
>> >> ><br>
>> >> > I've done the patch and testcase to fix PR14338.<br>
>> >> > <a href="http://llvm.org/bugs/show_bug.cgi?id=14388" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=14388</a><br>
>> >> ><br>
>> >> > Here's the patch, please review:<br>
>> >> > <a href="http://llvm.org/bugs/attachment.cgi?id=9574&action=diff" target="_blank">http://llvm.org/bugs/attachment.cgi?id=9574&action=diff</a><br>
>> >> ><br>
>> >> ><br>
>> >> > Is that okay to commit?<br>
>> >><br>
>> >> A matching update is needed in SemaTemplateInstantiateDecl. Perhaps<br>
>> >> you could put this logic into CheckSepcifiedExceptionType (and either<br>
>> >> return the modified type or pass it through by reference)? One of the<br>
>> >> checks in  CheckSpecifiedExceptionType also needs updating. With your<br>
>> >> patch, we still reject this:<br>
>> >><br>
>> >> struct S {<br>
>> >>   void f() throw (S[10]);<br>
>> >> };<br>
>> >><br>
>> >> ... but we should accept it, because the type 'S' is supposed to be<br>
>> >> considered as complete in exception specifications inside its body.<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Best regards,<br>
>> > Wen-Han Gu (Nowar)<br>
>> ><br>
><br>
><br>
><br>
><br>
> --<br>
> Best regards,<br>
> Wen-Han Gu (Nowar)<br>
><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Best regards,<div>Wen-Han Gu (Nowar)</div><br>
</div></div></div>
</blockquote></div></div></div><div><div><br><br clear="all"><div><br></div>-- <br>Best regards,<div>Wen-Han Gu (Nowar)</div><br>
</div></div></div>
</blockquote></div></div></div><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Best regards,<div>WenHan Gu (Nowar)</div><br>
</div>