[Bug c++/90776] New: g++ -fms-extensions is inconsistent with Microsoft's compiler

zhonghao at pku dot org.cn gcc-bugzilla@gcc.gnu.org
Fri Jun 7 02:52:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90776

            Bug ID: 90776
           Summary: g++ -fms-extensions is inconsistent with Microsoft's
                    compiler
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

The code is:

typedef struct a {} A;

void f() {
 if (__builtin_alignof(A))
 ;
}

g++ -fms-extensions rejects the code:

 error: ‘__builtin_alignof’ was not declared in this scope; did you mean
‘__builtin_asinhf’?
    4 |  if (__builtin_alignof(A))
      |      ^~~~~~~~~~~~~~~~~
      |      __builtin_asinhf

clang++ -fms-extensions accepts the code, and Microsoft's compiler also accepts
the code:

https://godbolt.org/z/HIAYtj

Another code sample is:

class __declspec(dllexport) A
{};

g++ rejects the code:

 error: expected initializer before ‘A’
    1 | class __declspec(dllexport) A
      |  

Microsoft's compiler accepts it.


More information about the Gcc-bugs mailing list