[llvm-bugs] [Bug 40210] New: c11: Accepts invalid program with incomplete type in generic-association.
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jan 3 03:04:40 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40210
Bug ID: 40210
Summary: c11: Accepts invalid program with incomplete type in
generic-association.
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: anders.granlund.0 at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Test case (prog.c):
int main()
{
_Generic(0, struct S: 1, default: (struct S { int x; }) { 0 } );
}
Compilation command line:
clang prog.c -Wall -Wextra -std=c11 -pedantic-errors
Observed behaviour:
No error messages outputed.
Expected behaviour:
An error message outputed.
The type specified by the type-name in the generic-association struct S: 1
is not complete yet. It is only completet much later.
The c standard is not very clear about at what point in the program a type
needs to be complete when it is used in a context where it is required to be
complete, but the completion is probably too late here (not complete by the
end of the type name, not even by the end of the generic-association).
Note:
GCC gives the expected error message.
There are alot of other similar differences between GCC and Clang about
exactly at what point a type needs to be complete. Clang seems to allow the
completion of a type much later than GCC.
--
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/20190103/2d2492e0/attachment-0001.html>
More information about the llvm-bugs
mailing list