https://bugs.llvm.org/show_bug.cgi?id=42176

            Bug ID: 42176
           Summary: clang -fms-extensions accepts a wrong code
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: zhong...@pku.org.cn
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

My clang is clang version 9.0.0 (trunk 362565) (llvm/trunk 362564), and my code
is:

typedef struct a {} A;

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


When compiling with clang++ -c -fms-extensions, it accepts the above code, but
clang++ rejects the code with other parameters. For example, with only -c, the
message is as follow:

4: error: unexpected type name 'A': expected expression
 if (__builtin_alignof(A))
                       ^
1 error generated.

Here, I tried g++, it also rejects the code:

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

So, with -fms-extensions, clang++ accepts wrong code?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to