[PATCH] Allow _MSC_EXTENSIONS macro on non-Windows targets

David Majnemer david.majnemer at gmail.com
Mon Mar 10 20:09:06 PDT 2014


  Consider the following:

    struct S {
      static const int i = 42;
    };

    const int *use() { return &S::i; }

  Compiling with `clang -cc1 -x c++ -S -o - -emit-llvm -triple i686-linux-gnu` does not produce a definition of `i`.

  Compiling with `clang -cc1 -x c++ -S -o - -emit-llvm -triple i686-pc-win32` produces `i` defined as `@"\01?i at S@@2HB" = linkonce_odr constant i32 42, align 4`.

  This matches MSVC's behavior: `?i at S@@2HB`

  We won't define `_MSC_EXTENSIONS` unless we are targeting the MSVC ABI **and** enable the MSVC-specific keywords with `-fms-extensions`.

http://llvm-reviews.chandlerc.com/D3034



More information about the cfe-commits mailing list