<div dir="ltr">I have this simple test program:<div><div>#include <stdio.h></div><div>#include <clang/AST/AST.h></div><div>#include <clang-c/Index.h></div><div><br></div><div>int main(){</div><div>        printf("this is a test\n");</div><div>        return 0;</div><div>}</div></div><div><br></div><div>when I try to compile it with clang++</div><div><div>clang++ -I/usr/local/llvm40/include test.cpp</div><div>In file included from test.cpp:9:</div><div>In file included from /usr/local/llvm40/include/clang/AST/AST.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTContext.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTTypeTraits.h:20:</div><div>In file included from /usr/local/llvm40/include/clang/AST/Decl.h:17:</div><div>In file included from /usr/local/llvm40/include/clang/AST/APValue.h:17:</div><div>In file included from /usr/local/llvm40/include/clang/Basic/LLVM.h:25:</div><div>/usr/local/llvm40/include/llvm/ADT/None.h:22:6: warning: scoped</div><div>      enumerations are a C++11 extension [-Wc++11-extensions]</div><div>enum class NoneType { None };</div><div>     ^</div><div>In file included from test.cpp:9:</div><div>In file included from /usr/local/llvm40/include/clang/AST/AST.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTContext.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTTypeTraits.h:20:</div><div>In file included from /usr/local/llvm40/include/clang/AST/Decl.h:17:</div><div>In file included from /usr/local/llvm40/include/clang/AST/APValue.h:18:</div><div>In file included from /usr/local/llvm40/include/llvm/ADT/APFloat.h:20:</div><div>In file included from /usr/local/llvm40/include/llvm/ADT/APInt.h:20:</div><div>/usr/local/llvm40/include/llvm/Support/MathExtras.h:248:1: error: </div><div>      unknown type name 'constexpr'</div><div>constexpr inline uint32_t Hi_32(uint64_t Value) {</div><div>^</div><div>/usr/local/llvm40/include/llvm/Support/MathExtras.h:248:11: error: </div><div>      expected unqualified-id</div><div>constexpr inline uint32_t Hi_32(uint64_t Value) {</div><div>          ^</div><div>/usr/local/llvm40/include/llvm/Support/MathExtras.h:253:1: error: </div><div>      unknown type name 'constexpr'</div><div>constexpr inline uint32_t Lo_32(uint64_t Value) {</div><div>^</div><div>/usr/local/llvm40/include/llvm/Support/MathExtras.h:253:11: error: </div><div>      expected unqualified-id</div><div>constexpr inline uint32_t Lo_32(uint64_t Value) {</div><div>          ^</div><div>/usr/local/llvm40/include/llvm/Support/MathExtras.h:259:1: error: </div><div>      unknown type name 'constexpr'</div><div>constexpr inline uint64_t Make_64(uint32_t High, uint32_t Low) {</div><div>^</div><div>/usr/local/llvm40/include/llvm/Support/MathExtras.h:259:11: error: </div><div>      expected unqualified-id</div><div>constexpr inline uint64_t Make_64(uint32_t High, uint32_t Low) {</div><div>          ^</div><div>/usr/local/llvm40/include/llvm/Support/MathExtras.h:264:23: error: </div><div>      unknown type name 'constexpr'</div><div>template <unsigned N> constexpr inline bool isInt(int64_t x) {</div><div>                      ^</div><div>/usr/local/llvm40/include/llvm/Support/MathExtras.h:264:33: error: </div><div>      expected unqualified-id</div><div>template <unsigned N> constexpr inline bool isInt(int64_t x) {</div><div>                                ^</div><div>/usr/local/llvm40/include/llvm/Support/MathExtras.h:702:10: error: use of</div><div>      undeclared identifier 'alignTo'</div><div>  return alignTo(Value, Align) - Value;</div><div>         ^</div><div>/usr/local/llvm40/include/llvm/Support/MathExtras.h:707:23: error: </div><div>      unknown type name 'constexpr'</div><div>template <unsigned B> constexpr inline int32_t SignExtend32(uint32_t X) {</div><div>                      ^</div><div>/usr/local/llvm40/include/llvm/Support/MathExtras.h:707:33: error: </div><div>      expected unqualified-id</div><div>template <unsigned B> constexpr inline int32_t SignExtend32(uint32_t X) {</div><div>                                ^</div><div>In file included from test.cpp:9:</div><div>In file included from /usr/local/llvm40/include/clang/AST/AST.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTContext.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTTypeTraits.h:20:</div><div>In file included from /usr/local/llvm40/include/clang/AST/Decl.h:17:</div><div>In file included from /usr/local/llvm40/include/clang/AST/APValue.h:18:</div><div>In file included from /usr/local/llvm40/include/llvm/ADT/APFloat.h:20:</div><div>/usr/local/llvm40/include/llvm/ADT/APInt.h:291:15: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>  APInt(APInt &&that) : BitWidth(that.BitWidth), VAL(that.VAL) {</div><div>              ^</div><div>/usr/local/llvm40/include/llvm/ADT/APInt.h:661:26: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>  APInt &operator=(APInt &&that) {</div><div>                         ^</div><div>/usr/local/llvm40/include/llvm/ADT/APInt.h:393:14: error: use of</div><div>      undeclared identifier 'isPowerOf2_64'</div><div>      return isPowerOf2_64(VAL);</div><div>             ^</div><div>/usr/local/llvm40/include/llvm/ADT/APInt.h:1387:20: error: no member</div><div>      named 'countTrailingOnes' in namespace 'llvm'; did you mean</div><div>      'countTrailingZeros'?</div><div>      return llvm::countTrailingOnes(VAL);</div><div>             ~~~~~~^~~~~~~~~~~~~~~~~</div><div>                   countTrailingZeros</div><div>/usr/local/llvm40/include/llvm/Support/MathExtras.h:111:13: note: </div><div>      'countTrailingZeros' declared here</div><div>std::size_t countTrailingZeros(T Val, ZeroBehavior ZB = ZB_Width) {</div><div>            ^</div><div>In file included from test.cpp:9:</div><div>In file included from /usr/local/llvm40/include/clang/AST/AST.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTContext.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTTypeTraits.h:20:</div><div>In file included from /usr/local/llvm40/include/clang/AST/Decl.h:17:</div><div>In file included from /usr/local/llvm40/include/clang/AST/APValue.h:18:</div><div>In file included from /usr/local/llvm40/include/llvm/ADT/APFloat.h:20:</div><div>/usr/local/llvm40/include/llvm/ADT/APInt.h:1399:20: error: no member</div><div>      named 'countPopulation' in namespace 'llvm'</div><div>      return llvm::countPopulation(VAL);</div><div>             ~~~~~~^</div><div>/usr/local/llvm40/include/llvm/ADT/APInt.h:1742:46: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>inline APInt operator+(const APInt &a, APInt &&b) {</div><div>                                             ^</div><div>/usr/local/llvm40/include/llvm/ADT/APInt.h:1762:46: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>inline APInt operator-(const APInt &a, APInt &&b) {</div><div>                                             ^</div><div>In file included from test.cpp:9:</div><div>In file included from /usr/local/llvm40/include/clang/AST/AST.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTContext.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTTypeTraits.h:20:</div><div>In file included from /usr/local/llvm40/include/clang/AST/Decl.h:17:</div><div>In file included from /usr/local/llvm40/include/clang/AST/APValue.h:18:</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:213:17: warning: 'final'</div><div>      keyword is a C++11 extension [-Wc++11-extensions]</div><div>class IEEEFloat final : public APFloatBase {</div><div>                ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:225:23: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>  IEEEFloat(IEEEFloat &&);</div><div>                      ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:330:46: warning: deleted</div><div>      function definitions are a C++11 extension [-Wc++11-extensions]</div><div>  bool operator==(const IEEEFloat &) const = delete;</div><div>                                             ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:408:34: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>  IEEEFloat &operator=(IEEEFloat &&);</div><div>                                 ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:600:21: warning: 'final'</div><div>      keyword is a C++11 extension [-Wc++11-extensions]</div><div>class DoubleAPFloat final : public APFloatBase {</div><div>                    ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:616:48: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>  DoubleAPFloat(const fltSemantics &S, APFloat &&First, APFloat &...</div><div>                                               ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:616:65: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>  ...fltSemantics &S, APFloat &&First, APFloat &&Second);</div><div>                                               ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:618:31: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>  DoubleAPFloat(DoubleAPFloat &&RHS);</div><div>                              ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:622:42: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>  DoubleAPFloat &operator=(DoubleAPFloat &&RHS) {</div><div>                                         ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:661:15: error: union member</div><div>      'IEEE' has a non-trivial copy constructor</div><div>    IEEEFloat IEEE;</div><div>              ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:224:3: note: because type</div><div>      'llvm::detail::IEEEFloat' has a user-provided copy constructor</div><div>  IEEEFloat(const IEEEFloat &);</div><div>  ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:662:19: error: union member</div><div>      'Double' has a non-trivial copy constructor</div><div>    DoubleAPFloat Double;</div><div>                  ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:617:3: note: because type</div><div>      'llvm::detail::DoubleAPFloat' has a user-provided copy constructor</div><div>  DoubleAPFloat(const DoubleAPFloat &RHS);</div><div>  ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:670:23: warning: variadic</div><div>      templates are a C++11 extension [-Wc++11-extensions]</div><div>    template <typename... ArgTypes></div><div>                      ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:671:53: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>    Storage(const fltSemantics &Semantics, ArgTypes &&... Args) {</div><div>                                                    ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:707:21: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>    Storage(Storage &&RHS) {</div><div>                    ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:733:32: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>    Storage &operator=(Storage &&RHS) {</div><div>                               ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:750:35: error: too many</div><div>      arguments provided to function-like macro invocation</div><div>                  std::is_same<T, DoubleAPFloat>::value, "");</div><div>                                  ^</div><div>/usr/include/c++/v1/__config:727:12: note: macro 'static_assert' defined</div><div>      here</div><div>#   define static_assert(__b, __m) _Static_assert(__b, __m)</div><div>           ^</div><div>In file included from test.cpp:9:</div><div>In file included from /usr/local/llvm40/include/clang/AST/AST.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTContext.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTTypeTraits.h:20:</div><div>In file included from /usr/local/llvm40/include/clang/AST/Decl.h:17:</div><div>In file included from /usr/local/llvm40/include/clang/AST/APValue.h:18:</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:825:33: warning: defaulted</div><div>      function definitions are a C++11 extension [-Wc++11-extensions]</div><div>  APFloat(const APFloat &RHS) = default;</div><div>                                ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:826:19: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>  APFloat(APFloat &&RHS) = default;</div><div>                  ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:826:28: warning: defaulted</div><div>      function definitions are a C++11 extension [-Wc++11-extensions]</div><div>  APFloat(APFloat &&RHS) = default;</div><div>                           ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:828:16: warning: defaulted</div><div>      function definitions are a C++11 extension [-Wc++11-extensions]</div><div>  ~APFloat() = default;</div><div>               ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:1016:44: warning: deleted</div><div>      function definitions are a C++11 extension [-Wc++11-extensions]</div><div>  bool operator==(const APFloat &) const = delete;</div><div>                                           ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:1052:44: warning: defaulted</div><div>      function definitions are a C++11 extension [-Wc++11-extensions]</div><div>  APFloat &operator=(const APFloat &RHS) = default;</div><div>                                           ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:1053:30: warning: rvalue</div><div>      references are a C++11 extension [-Wc++11-extensions]</div><div>  APFloat &operator=(APFloat &&RHS) = default;</div><div>                             ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:1053:39: warning: defaulted</div><div>      function definitions are a C++11 extension [-Wc++11-extensions]</div><div>  APFloat &operator=(APFloat &&RHS) = default;</div><div>                                      ^</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:1078:10: warning: </div><div>      unelaborated friend declaration is a C++11 extension; specify</div><div>      'class' to befriend 'IEEEFloat' (aka 'llvm::detail::IEEEFloat')</div><div>      [-Wc++11-extensions]</div><div>  friend IEEEFloat;</div><div>         ^</div><div>         class</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:1079:10: warning: </div><div>      unelaborated friend declaration is a C++11 extension; specify</div><div>      'class' to befriend 'DoubleAPFloat' (aka</div><div>      'llvm::detail::DoubleAPFloat') [-Wc++11-extensions]</div><div>  friend DoubleAPFloat;</div><div>         ^</div><div>         class</div><div>/usr/local/llvm40/include/llvm/ADT/APFloat.h:749:5: error: use of</div><div>      undeclared identifier 'static_assert'</div><div>    static_assert(std::is_same<T, IEEEFloat>::value ||</div><div>    ^</div><div>In file included from test.cpp:9:</div><div>In file included from /usr/local/llvm40/include/clang/AST/AST.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTContext.h:18:</div><div>In file included from /usr/local/llvm40/include/clang/AST/ASTTypeTraits.h:20:</div><div>In file included from /usr/local/llvm40/include/clang/AST/Decl.h:17:</div><div>In file included from /usr/local/llvm40/include/clang/AST/APValue.h:20:</div><div>In file included from /usr/local/llvm40/include/llvm/ADT/PointerIntPair.h:18:</div><div>/usr/local/llvm40/include/llvm/Support/PointerLikeTypeTraits.h:45:61: error: </div><div>      'T' does not refer to a value</div><div>  enum { NumLowBitsAvailable = detail::ConstantLog2<alignof(T)>::value };</div><div>                                                            ^</div><div>/usr/local/llvm40/include/llvm/Support/PointerLikeTypeTraits.h:40:20: note: </div><div>      declared here</div><div>template <typename T> class PointerLikeTypeTraits<T *> {</div><div>                   ^</div><div>fatal error: too many errors emitted, stopping now [-ferror-limit=]</div><div>28 warnings and 20 errors generated.</div></div><div><br></div><div>then I try with verbose output along with -std=c++11</div><div><br></div><div><div>clang -v -std=c++11 test.cpp</div><div>FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM 4.0.0)</div><div>Target: x86_64-unknown-freebsd12.0</div><div>Thread model: posix</div><div>InstalledDir: /usr/bin</div><div> "/usr/bin/clang" -cc1 -triple x86_64-unknown-freebsd12.0 -emit-obj -mrelax-all -disable-free -main-file-name test.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -resource-dir /usr/bin/../lib/clang/4.0.0 -I/usr/local/include -I/usr/local/llvm40/include -c-isystem -I/usr/local/llvm40/include -cxx-isystem -I/usr/local/llvm40/include -internal-isystem /usr/include/c++/v1 -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /home/blubee -ferror-limit 19 -fmessage-length 102 -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/test-10b94f.o -x c++ test.cpp</div><div>clang -cc1 version 4.0.0 based upon LLVM 4.0.0 default target x86_64-unknown-freebsd12.0</div><div>ignoring nonexistent directory "-I/usr/local/llvm40/include"</div><div>ignoring nonexistent directory "-I/usr/local/llvm40/include"</div><div>#include "..." search starts here:</div><div>#include <...> search starts here:</div><div> /usr/local/include</div><div> /usr/local/llvm40/include</div><div> /usr/include/c++/v1</div><div> /usr/bin/../lib/clang/4.0.0/include</div><div> /usr/include</div><div>End of search list.</div><div> "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o a.out /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /tmp/test-10b94f.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o</div><div>/tmp/test-10b94f.o:(.data+0x0): undefined reference to `llvm::DisableABIBreakingChecks'</div><div>clang: error: linker command failed with exit code 1 (use -v to see invocation)</div></div><div><br></div><div>still getting a linker error, am I overlooking something simple? What's going on?</div><div><br>Best</div></div>