[llvm-bugs] [Bug 38353] New: clang fails to diagnose mismatch of enum types in prototype/function

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 28 23:40:00 PDT 2018


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

            Bug ID: 38353
           Summary: clang fails to diagnose mismatch of enum types in
                    prototype/function
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: llvm-bugs at lists.llvm.org

Compile the following code, clang compiles it without error: it
should generate a diagnostic.

enum e1 {a, b};
enum e2 {c, d};

void f(enum e1);

void f(x)
  enum e2 x;
{
  return;
}

Instead, gcc rejects the above code:

gcc code0.c 
code0.c: In function 'f':
code0.c:7:10: error: argument 'x' doesn't match prototype
  enum e2 x;
          ^
code0.c:4:6: error: prototype declaration
 void f(enum e1);
      ^

-- 
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/20180729/65fd6c92/attachment-0001.html>


More information about the llvm-bugs mailing list