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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to