[LLVMbugs] [Bug 8551] New: Wrong type for address-of anonymous union member.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Nov 5 06:47:49 PDT 2010


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

           Summary: Wrong type for address-of anonymous union member.
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: zaffanella at cs.unipr.it
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


clang++ generates an error diagnostic when parsing the following program (from
g++ testsuite):

struct myclass {
  unsigned a;
  union {
    unsigned x;
  };
};

int main () {
  myclass foo;
  unsigned myclass::* member = &myclass::x;
  if (&(foo.*member) != &foo.x)
    return 1;
}


$ clang++ -cc1 bug.C
bug.C:13:23: error: cannot initialize a variable of type 'unsigned int
myclass::*' with an rvalue of type 'unsigned int myclass::<anonymous union at
bug.C:6:3>::*'
  unsigned myclass::* member = &myclass::x;
                      ^        ~~~~~~~~~~~
1 error 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.



More information about the llvm-bugs mailing list