On Thu, Oct 16, 2014 at 10:23 AM, Aaron Ballman <[email protected]> wrote:
> On Thu, Oct 16, 2014 at 9:05 AM, Aaron Ballman <[email protected]> wrote:
>> On Wed, Oct 15, 2014 at 10:33 PM, Richard Smith <[email protected]> 
>> wrote:
>>> Does this still warn on cases like:
>>>
>>>   typeid(f(), g());
>>>
>>> where we don't know we've got an evaluated operand until after we've
>>> finished parsing it?
>>>
>>> ... Hmm, we don't seem to get any warning on that case right now. =( Might
>>> be worth someone looking into that, maybe there are other cases we're
>>> missing.
>
> I'd like to make sure my understanding is correct. Given:
>
> #include <typeinfo>
>
> struct B {
>   virtual int f();
> };
>
> struct D : B {
>   virtual int f();
> };
>
> B *h() __attribute__((warn_unused_result));
> B *h() { return new D; }
>
> int f() __attribute__((warn_unused_result));
> int g();
>
> int main() {
>   const auto &t1 = typeid(f(), g()); // Should not warn; unevaluated context?
>   const auto &t2 = typeid(h(), g()); // Should warn; evaluated context?
> }
>
> Is that the test case we're looking at for the typeid portion of this?

I don't think it is. The result of h(), g() is still int, which is not
a glvalue of polymorphic type. I'm struggling to think of a way in
which I should trigger the unused result warning in the potentially
evaluated case that wouldn't count as a use.

~Aaron
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to