On Tuesday, 27 October 2015 at 16:05:31 UTC, tsbockman wrote:
On Tuesday, 27 October 2015 at 13:23:51 UTC, Timon Gehr wrote:
Versions of the same statement in different instantiations are independent. Templates are just a restricted form of hygienic macros.

That's how the current implementation works, but that doesn't mean the warning is actually *helpful*.

Well, arguably that's exactly what templates _are_ regardless of the implementation - i.e. a template is just a template to generate code, not really actual code in and of itself. Now, that being said, I'm not sure that warning about unreachable code in a templated function is particularly helpful - particularly if it forces you to jump through hoops to make the compiler shut up about it. Heck, if anything, I find that warning/error annoying in regular code, because it tends to get in the way of debugging while developing. It wouldn't really hurt my feelings any if we just removed it from the compiler entirely - though I completely agree that you don't really want to have unreachable code left in your production code.

- Jonathan M Davis

Reply via email to