<div dir="ltr">The right way to write this is:<div><br></div><div><div>- if (const EnumType *ET = dyn_cast<EnumType>(T))</div><div>+ if (const EnumType *ET = T->getAs<EnumType>())</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 16, 2014 at 5:51 AM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">LGTM.<br>
<br>
Clang is not my expertise, but the patch looks clearly correct, fixes<br>
a bug and has a testcase.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On 16 December 2014 at 04:49, Stephan Bergmann <<a href="mailto:sbergman@redhat.com">sbergman@redhat.com</a>> wrote:<br>
> ping<br>
><br>
><br>
> On 11/25/2014 03:04 PM, Rafael Espíndola wrote:<br>
>><br>
>> ccing Richard.<br>
>> On 25 November 2014 at 03:38, Stephan Bergmann <<a href="mailto:sbergman@redhat.com">sbergman@redhat.com</a>><br>
>> wrote:<br>
>>><br>
>>> ping<br>
>>><br>
>>><br>
>>> On 11/10/2014 06:18 PM, Stephan Bergmann wrote:<br>
>>>><br>
>>>><br>
>>>> On 10/23/2014 10:41 AM, David Majnemer wrote:<br>
>>>>><br>
>>>>><br>
>>>>> Per the developer policy [1], please add a test case to accompany your<br>
>>>>> change.<br>
>>>>><br>
>>>>> [1] <a href="http://llvm.org/docs/DeveloperPolicy.html#test-cases" target="_blank">http://llvm.org/docs/DeveloperPolicy.html#test-cases</a><br>
>>>>><br>
>>>>> Looks good otherwise.<br>
>>>><br>
>>>><br>
>>>><br>
>>>> Attached updated patch including test case.<br>
>>>><br>
>>>>> On Thu, Oct 23, 2014 at 12:43 AM, Stephan Bergmann <<a href="mailto:sbergman@redhat.com">sbergman@redhat.com</a><br>
>>>>> <mailto:<a href="mailto:sbergman@redhat.com">sbergman@redhat.com</a>>> wrote:<br>
>>>>><br>
>>>>> [ping]<br>
>>>>><br>
>>>>><br>
>>>>> On 10/14/2014 04:12 PM, Stephan Bergmann wrote:<br>
>>>>><br>
>>>>> $ clang++ --version<br>
>>>>> clang version 3.6.0 (trunk 219190)<br>
>>>>> Target: x86_64-unknown-linux-gnu<br>
>>>>> Thread model: posix<br>
>>>>><br>
>>>>> $ cat test.cc<br>
>>>>> enum class E { e };<br>
>>>>> typedef E E2;<br>
>>>>> E2 f1() { return E::e; }<br>
>>>>> E f2() { return E::e; }<br>
>>>>> bool g1() { return !f1(); }<br>
>>>>> bool g2() { return !f2(); }<br>
>>>>><br>
>>>>> $ clang++ -std=c++11 -c test.cc<br>
>>>>> test.cc:6:20: error: invalid argument type 'E' to unary<br>
>>>>> expression<br>
>>>>> bool g2() { return !f2(); }<br>
>>>>> ^~~~~<br>
>>>>> 1 error generated.<br>
>>>>><br>
>>>>><br>
>>>>> rightly complains about the invalid contextual conversion to<br>
>>>>> bool in g2<br>
>>>>> but erroneously not also about the one in g1.<br>
>>>>><br>
>>>>> Index: lib/Sema/SemaExpr.cpp<br>
>>>>><br>
>>>>> ==============================__==============================__=======<br>
>>>>> --- lib/Sema/SemaExpr.cpp (revision 219190)<br>
>>>>> +++ lib/Sema/SemaExpr.cpp (working copy)<br>
>>>>> @@ -7414,7 +7414,7 @@<br>
>>>>> }<br>
>>>>><br>
>>>>> static bool isScopedEnumerationType(__QualType T) {<br>
>>>>> - if (const EnumType *ET = dyn_cast<EnumType>(T))<br>
>>>>> + if (const EnumType *ET =<br>
>>>>> dyn_cast<EnumType>(T.__getCanonicalType()))<br>
>>>>><br>
>>>>> return ET->getDecl()->isScoped();<br>
>>>>> return false;<br>
>>>>> }<br>
>>>>><br>
>>>>><br>
>>>>> would fix that for me.<br>
><br>
><br>
</div></div></blockquote></div><br></div>