[LLVMbugs] [Bug 11036] New: Problem with sizeof accessing a class member inside a struct
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Wed Sep 28 22:20:46 PDT 2011
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=11036
           Summary: Problem with sizeof accessing a class member inside a
                    struct
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: llvm at behdad.org
                CC: llvmbugs at cs.uiuc.edu
With the following code:
class C {
        int i;
        void f (void) {
                typedef int a[sizeof (i)];
                typedef struct {
                        int a[sizeof (i)];
                } s;
        }
};
I get the following error from clang:
a.cc:7:18: error: invalid use of nonstatic data member 'i'
                        int a[sizeof (i)];
                                      ^
1 error generated.
Ie. clang doesn't like sizeof(i) in a struct, but it's ok in a non-struct. 
Looks like a bug to me.
-- 
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.
    
    
More information about the llvm-bugs
mailing list