Patch #3417 2013-02-02 04:52
hsolter
Disable the definition of nullptr_t when using clang- Download
- 3417-Disable_the_de.patch (600 bytes)
Index: src/include/prep.h
===================================================================
--- src/include/prep.h (revision 8813)
+++ src/include/prep.h (working copy)
@@ -9,8 +9,12 @@
#ifndef wxMAJOR_VERSION
#include <wx/version.h>
#endif
+#ifndef __has_feature
+ #define __has_feature(x) 0
+#endif
-#if !(__GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined __GXX_EXPERIMENTAL_CXX0X__)
+#if !(__GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined __GXX_EXPERIMENTAL_CXX0X__) \
+ && !(__clang__ && __has_feature(cxx_nullptr))
// it is a const object...
const class nullptr_t
{
History
Unlike g++, nullptr_t is defined when using clang in cxx mode which causes compilation problems. Patch disables the class definition and macro when using clang in cxx mode.
Unlike g++, nullptr_t is defined when using clang in cxx mode which causes compilation problems. Patch disables the class definition and macro when using clang in cxx mode.
When does the problem occur? I have previously compiled Code::Blocks with Clang, and no errors occurred from nullptr_t.
You probably compiled it in c++2003 mode (the default) since the c++11 defines nullptr it gives error when -std=c++11 is defined.Patch fixs this just like the gcc.
Of course the real problem is the line
#define nullptr nullptr_
It is a bad idea to redefine a keyword..
Of course the real problem is the line
#define nullptr nullptr_
It is a bad idea to redefine a keyword..
The reason Code::Blocks (conditionally) defines nullptr is to back-port this feature for people stuck on old compilers.
Of course I knew that. I was just pointing out the line that causes the problem in c++11 mode