Andrei, I'm a bit surprised by this statement. Could you give an example?
Otherwise great work.
Andrei, I'm a bit surprised by this statement. Could you give an example?
Otherwise great work.
GCC can call the base destructor explicitly in destructors (an error in clang). i.e. this->~BaseClass(); This is normally a coding error anyway, since the call is added by the compiler.
You sometimes have to add this-> in templates to disambiguate which function is called.
GCC has, or had, a better (different?) two-phase look up for templates, so you can #include a file after its template is used in another header. Clang is stricter and requires you #include "A.h" and #include "foo.h" before using A<foo>, even if the overall compilation unit does eventually declare the A template and the foo class.
GCC supports variable length arrays, so you can do `MyClass x[someValue + 1];`, but with Clang you need to use a vector of MyClass, like vector<MyClass> x(someValue + 1).
This sort of thing compiles in GCC, but not clang:
template <typename T>
class List : public list<T> {};
const List<string> tmpList;
It is missing a default constructor, GCC finds one from somewhere :)GCC allows friends of derived classes to call static base class protected functions. i.e. Base::protectedFunc() can be called if the current class is a friend only of BaseSubclass. In clang you need to call BaseSubclass::protectedFunc().
Clang requires more explicit template instantiation to avoid link errors. Not sure exactly when, just "sometimes" and you'll know it when you see it :-)
Then as mentioned elsewhere clang shouts a lot about mismatched forward declaration (struct vs class).
Some of our code used GCC nested functions, which Clang did not support.
We were using __sync_val_compare_and_swap with __int128 values, which wasn't supported by the Clang version we were using. I believe the current version of Clang supports this.
Clang is stricter about some things than GCC, e.g. Clang doesn't like it when you declare a class as struct in one place and in a class in another place.
I think there is also a difference where Clang deduces that your enum is unsigned if none of its declared values are negative, and warns you if you compare it < 0. Since we compile with -Werror, this will cause compilation to fail.
None of these are unsurmountable, but they do mean we can't just drop in Clang and expect everything to work.
"clang-3.4: error: unable to execute command: Segmentation fault"
But still, I submit a clang-based tool is a better bet in the long run.