[LLVMbugs] [Bug 13646] New: No error about changing const variable via struct/union copy

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Aug 19 23:01:18 PDT 2012


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

             Bug #: 13646
           Summary: No error about changing const variable via
                    struct/union copy
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: tss at iki.fi
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


union foo {
    int a;
    const int b;
};

int main(void)
{
    union foo f1, f2;

    f1.a = 5;
    f2 = f1;
    return 0;
}

gcc fails:

test2.c:11:2: error: assignment of read-only variable ‘f2’

clang gives no error.

-- 
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