http://llvm.org/bugs/show_bug.cgi?id=3003

           Summary: clang: does not treat expression involving struct
                    pointer as a constant in array declaration
           Product: clang
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [email protected]
            Blocks: 2778


This is a reduced version of another parser reject from DragonFly BSD's kernel
source (see bug 2778).

(If you think this is ugly, you should see the original code in all of its
expanded macro glory...)


struct str1 { char c; };

struct str2 {
  int intarray[ (int)&((struct str1 *)0)->c + 1];
};


% gcc-4.2 -W -Wall -pedantic -fsyntax-only -std=c99 array-length.c

% clang -fsyntax-only -std=c99 array-length.c
array-length.c:4:7: error: arrays with static storage duration must have
constant integer length
  int intarray[ (int)&((struct str1 *)0)->c + 1];
      ^~~~~~~~
1 diagnostic generated.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to