[cfe-dev] -Wunreachable-code and templates

David Blaikie dblaikie at gmail.com
Wed Nov 30 21:16:14 PST 2011


> Templates are used to generate code. Subjecting them to
> -Wunreachable-code implies that all the potentially generated code has
> to exist in all instantiations.

Well that's true of -Wunreachable-code before Ted's changes today, but
it's possible that there are real problems that could be detected if
we were smart enough:

template<typename T>
void foo() {
  if (false)
    bar();
}

It'd be nice if we could diagnose that while not having false
positives related to the sort of scenarios you're describing (where
code is conditional on template parameters)



More information about the cfe-dev mailing list