This is the mail archive of the gcc-patches@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]

Re: [patch][C++] Enhancements to -Wconversion-null


On 06/25/2010 07:29 PM, Le-Chun Wu wrote:
+      if (arg == null_node
+          && DECL_TEMPLATE_INFO (fn)
+          && cand->template_decl
+          && !(flags & LOOKUP_EXPLICIT_TMPL_ARGS))
+        conversion_warning = false;

1) You don't need a new flag, you can just test cand->explicit_targs.


2) Testing for any explicit template arguments isn't really the right test: consider

template <class T> void f(T, int);

int main()
{
  f(1.0, NULL);
}

This call has no explicit template arguments, but it still passes NULL to a parameter that was not deduced from NULL.

3) Why do you want to suppress the warning in the deduced case, anyway? Passing NULL to f(T) will still mean that we're calling f(uintptr_t) rather than f(some pointer), and is probably still wrong.

Jason


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