Error with function prototypes and __restrict

Hi,

here's another error (at least a deviation from gcc behaviour):

     s0539:src nico$ cat test.c

     #include <sys/select.h>
     extern int select (int, fd_set *, fd_set *, fd_set *, struct timeval *);

     s0539:src nico$ gcc -fsyntax-only test.c

     s0539:src nico$ ./clang test.c
     running "/Users/nico/src/llvm-svn/Debug/bin/clang -fsyntax-only test.c"
     test.c:3:12: error: redefinition of 'select'
     extern int select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
                ^
     In file included from test.c:1:
     In file included from /usr/include/sys/select.h:152:
     /usr/include/sys/_select.h:39:6: error: previous definition is here
     int select(int, fd_set * __restrict, fd_set * __restrict,
              ^
     2 diagnostics generated.

Nico

Here's a reduced testcase:

int test(int * restrict);
int test(int *);

-Chris

Sema::MergeFunctionDecl has a FIXME section about this. Currently it either replaces or doesn’t replace the function decl (or errors out) rather than merging.