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

            Bug ID: 44406
           Summary: Const is not compile-time constant
           Product: clang
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangb...@nondot.org
          Reporter: mc...@gmx.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

const int a = 32;

typedef struct {
    char c[a];
} d;

GCC: error: variably modified 'c' at file scope
CompCert: error: size of array is not a compile-time constant

Clang -Wextra: *compiles*
Clang -pedantic: warning: variable length array folded to constant array as an
extension [-Wgnu-folding-constant]

The problem? This is not a GNU extension. Either the warning is wrong or the
code that shouldn't compile compiles.

Weirdly, MSVC has the same behavior as Clang but does not issue a warning.

Once it is confirmed, I'll file an Apple bug report, because an Xcode header,
Security.framework/Headers/Authorization.h suffers from this issue and can only
be compiled with Clang (so when this bug is patched don't tell me that I broke
Apple's 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