[llvm-bugs] [Bug 31796] New: clang 3.9.1 fails to reject or even warn about some forms of assignments to const struct fields

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jan 29 17:10:24 PST 2017


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

            Bug ID: 31796
           Summary: clang 3.9.1 fails to reject or even warn about some
                    forms of assignments to const struct fields
           Product: clang
           Version: 3.9
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: markmi at dsl-only.net
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

[The context for this was FreeBSD head -r312942
and so its clang 3.9.1 variant.]

clang 3.9.1 in FreeBSD allows the
following to compile without
complaint, even with -Wpedantic :
(Note the const between the * and the desc.)

struct mlx5_core_diagnostics_entry {
    const char           *const desc;
          unsigned short        counter_id;
} empty;

int main ()
{
    struct mlx5_core_diagnostics_entry test;
    test = empty;
}

gcc6, by contrast, rejects the assignment
as an error.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170130/68c01f65/attachment.html>


More information about the llvm-bugs mailing list