[PATCH] Fixed UseNullptr causes compile error when replacing return(0);

Dmitri Gribenko gribozavr at gmail.com
Tue Mar 5 13:04:56 PST 2013



================
Comment at: test/cpp11-migrate/UseNullptr/basic.cpp:27-28

----------------
On an unrelated note, replacing explicit casts can affect overload resolution.  For example:

```
int f(int *);
int f(double *);
int main() {
  f((int *)0);
  return 0;
}
```

This program is correct, but cpp11-migrate will replace the call with `f(nullptr)`, which is ambigous.

I think that explicit casts should not be replaced altogether with nullptr, but they should be replaced with a single cast.  We could also implement a non-C++11-specific automatic refactoring to remove extra unneeded casts.



http://llvm-reviews.chandlerc.com/D496



More information about the cfe-commits mailing list