[LLVMbugs] [Bug 22249] New: "typedef requires a name" should not always be an error with -pedantic-errors
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Jan 16 04:54:13 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22249
Bug ID: 22249
Summary: "typedef requires a name" should not always be an
error with -pedantic-errors
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: harald at gigawatt.nl
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Compiling
typedef struct S { };
with -pedantic-errors gives
test.cc:1:1: error: typedef requires a name [-Werror,-Wmissing-declarations]
typedef struct S { };
^~~~~~~
1 error generated.
This should remain a warning. There is no rule in C++ (C++11, anyway) anywhere
disallowing this, and GCC does accept it when compiling with -pedantic-errors.
Note:
typedef struct { };
gives the exact same error message, but clang is right to reject this (as is
GCC). This violates [dcl.dcl]p5: "In such cases, the decl-specifier-seq shall
introduce one or more names into the program, or shall redeclare a name
introduced by a previous declaration" with or without the typedef keyword.
--
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/20150116/06eb38c8/attachment.html>
More information about the llvm-bugs
mailing list