[llvm-bugs] [Bug 45726] New: _Generic selection failed to compile with enum

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 28 23:58:13 PDT 2020


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

            Bug ID: 45726
           Summary: _Generic selection failed to compile with enum
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rajendra.sy at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 23419
  --> https://bugs.llvm.org/attachment.cgi?id=23419&action=edit
C program with _Generic selection failed to compile with enum

$ clang --version
clang version 10.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ clang -o /tmp/test /tmp/test.c
/tmp/test.c:41:35: error: unknown type name 'CheckBegin'
  printf("Check %d: %s\n", start, checkEnum(start)? "Yes" : "No");
                                  ^
/tmp/test.c:29:34: note: expanded from macro 'checkEnum'
                    enum Begin : CheckBegin, \
                                 ^
/tmp/test.c:41:35: error: expected ':'
/tmp/test.c:29:44: note: expanded from macro 'checkEnum'
                    enum Begin : CheckBegin, \
                                           ^
/tmp/test.c:42:34: error: unknown type name 'CheckBegin'
  printf("Check %d: %s\n", stop, checkEnum(stop)? "Yes" : "No");
                                 ^
/tmp/test.c:29:34: note: expanded from macro 'checkEnum'
                    enum Begin : CheckBegin, \
                                 ^
/tmp/test.c:42:34: error: expected ':'
/tmp/test.c:29:44: note: expanded from macro 'checkEnum'
                    enum Begin : CheckBegin, \
                                           ^
/tmp/test.c:43:32: error: unknown type name 'CheckBegin'
  printf("Check %d: %s\n", na, checkEnum(na)? "Yes" : "No");
                               ^
/tmp/test.c:29:34: note: expanded from macro 'checkEnum'
                    enum Begin : CheckBegin, \
                                 ^
/tmp/test.c:43:32: error: expected ':'
/tmp/test.c:29:44: note: expanded from macro 'checkEnum'
                    enum Begin : CheckBegin, \
                                           ^
6 errors generated.

No errors with clang-7
$ clang --version
Juniper clang version 7.0.1
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ clang -o /tmp/test /tmp/test.c
<no-compilation-errors>

-- 
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/20200429/28873af0/attachment-0001.html>


More information about the llvm-bugs mailing list