This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Warnings in templates


Jason --

Do you understand why we seem to be trying so hard to issue warnings
about things like functions that do not return in templates?

There's no reasonable way to avoid false positives here; consider
things like:

  extern "C" exit (int) __attribute((noreturn));
  extern void exit(float);

  template <typename T>
  void f() {
    exit (T);
  }

PR 15742 is one case similar to this.  I'm going to fix that one, but
to fix the case I give above, you'd have to consider any dependent
call to a function with the same name as one that is known not to
return as reason to suppress the warning.

I understand the motivation to warn early and to warn on the template
definitions rather than each of its instantiations, but this seems
like the kind of thing where we should just wait until instantiation
time.

Thoughts?

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]