[llvm-bugs] [Bug 42176] New: clang -fms-extensions accepts a wrong code

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 6 19:22:24 PDT 2019


            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: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

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

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
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190607/251cb9b0/attachment.html>

More information about the llvm-bugs mailing list