[cfe-commits] r62971 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/Sema.h lib/Sema/SemaExprCXX.cpp lib/Sema/SemaOverload.cpp lib/Sema/SemaType.cpp test/SemaCXX/member-pointer.cpp test/SemaCXX/qualification-conversion.cpp

Chris Lattner clattner at apple.com
Wed Jan 28 09:50:53 PST 2009


On Jan 28, 2009, at 9:15 AM, Douglas Gregor wrote:

>
> On Jan 28, 2009, at 8:25 AM, Sebastian Redl wrote:
>
>> Chris Lattner wrote:
>>> On Jan 25, 2009, at 11:43 AM, Sebastian Redl wrote:
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=62971&view=rev
>>>> Log:
>>>> Implement implicit conversions for pointers-to-member.
>>>
>>>> +      bool DerivationOkay = IsDerivedFrom(ToClass, FromClass,  
>>>> Paths);
>>>> +      assert(DerivationOkay &&
>>>> +             "Should not have been called if derivation isn't  
>>>> OK.");
>>>> +      if (!DerivationOkay)
>>>> +        return true;
>>>
>>> This 'if' (and others like it) are dead code, please remove it, the
>>> assertion should be enough.
>> The problem with removing it is that it makes the variable unused in
>> release builds. Do we have some cross-compiler way of suppressing
>> resulting warnings?
>
> Chris likes to write something like:
>
>  assert(DerivationOkay && "blah"); DerivationOkay = DerivationOkay;
>
> I've been moving toward
>
>  assert(DerivationOkay && "blah"); (void)DerivationOkay;

Ooh, that is nicer :)

I wish that assert(X) expanded into "(void)(X)" when in NDEBUG mode.   
That way we'd get side effects and issues like this would go away :-/

-Chris



More information about the cfe-commits mailing list