The following code builds with g++ 4.4.3 (Ubuntu 4.4.3-4ubuntu5) but not with clang version 3.1 (trunk 147292):
template<class Predicate> void find_if(Predicate p) { void *x = 1; }
g++ "mostly ignores" the body of find_if since it's never instantiated, while clang determines that you "cannot initialize a variable of type 'void *' with an rvalue of type 'int'".
Thanks, clang!
Entry first conceived on 27 December 2011, 20:35 UTC, last modified on 9 April 2012, 20:16 UTC
Website Copyright © 2004-2024 Jeff Epler