Conversion from integral constant expression to null-pointer
Consider following code: #include <memory> void f( std::shared_ptr<int> ) {} int main() { f( 0 ); // compiles fine in gcc and clang f( 1 - 1 ); // compiles fine in gcc, fails in clang constexpr int i = 0; f( i ); // fails to compile in gcc and clang f( i - 0 ); // compiles fine in gcc, fails in clang } why only f( i ) fails to compile, though i should be evaluated as compile time constant with value 0? PS checked with g++ v 5.1.0, it accepts all variants except f(i); in both c++11 and c++14 mode PPS checked with clang 3.7, it rejects all variants except literal 0 in both c++11 and c++14 mode