[llvm-bugs] [Bug 40169] New: c11: Accepts ill-formed program using an enum type before it is complete.
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Dec 27 20:57:58 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=40169
Bug ID: 40169
Summary: c11: Accepts ill-formed program using an enum type
before it is complete.
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
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 program (prog.c):
int main()
{
enum E { x = sizeof (enum E *) };
}
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 use of the typespecifier enum E in enum E * is not allowed becuase
the enum E is not yet complete at that point.
References to the c17 (bugfix of c11) standard:
6.7.2.3/3:
"A type specifier of the form enum identifier without an enumerator list
shall only appear after the type it specifies is complete."
6.7.2.2/4:
"... The enumerated type is incomplete until immediately after the }
that terminates the list of enumerator declarations, and complete
thereafter."
Note:
GCC outputs the expected error message.
--
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/20181228/37bea248/attachment-0001.html>
More information about the llvm-bugs
mailing list