On Mon, Dec 12, 2011 at 04:00:44PM +0100, Pascal Stumpf wrote: > On Mon, 12 Dec 2011 14:41:45 +0100 (CET), Mark Kettenis wrote: > > > > The s/restrict/__restrict/g in cstdio shouldn't be necessary. > > Apparently, clang++ interprets "restrict" as parameter name, i.e.: > > attr.cc:1:50: error: redefinition of parameter 'restrict' > extern "C" int foo(const char * restrict, char * restrict, ...) > ^ > attr.cc:1:33: note: previous declaration is here > extern "C" int foo(const char * restrict, char * restrict, ...) > ^ > > This might indeed be a bug, but I'd have to read the C++ standard to be > sure. In pure C, clang doesn't complain.
I'm not that surprised. restrict is C99. It's not part of C++98. Googling for restrict and C++ show various bug-reports explicitly stating that library headers should probably adapt. I don't have access to C++ 2011 yet, but from n3242, it seems that it does now refer to C99 instead of C89, so restrict is probably leggit in C++2011. So it looks to me like clang in C++98 mode is totally right to not recognize restrict as a keyword!