Fixing spurious "statement is not reachable" in template code

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 27 14:14:25 PDT 2015


On 10/27/2015 09:18 PM, tsbockman wrote:
> On Tuesday, 27 October 2015 at 19:30:08 UTC, Timon Gehr wrote:
>> On 10/27/2015 06:35 PM, Steven Schveighoffer wrote:
>>> I understand how the compiler treats it.  In some cases, the statement
>>> is reachable, the compiler is unhelpfully pointing out cases where it
>>> was unreachable.
>>
>> The reachable statement is not the same as the statement that is
>> flagged unreachable. This is not an implementation detail and it is
>> not 'incorrect'. It might be changed if the consensus is that it is
>> unhelpful. Personally, I usually avoid generating dead code.
>
> I don't think any dead code is being generated,

This seems to be a misunderstanding. I mean generated using mixins or 
template instantiation. Sure, it will usually be removed, but why 
generate and semantically analyze it in the first place.



More information about the Digitalmars-d mailing list