__builtin_index not recognized.


The following program fragment, which compiles cleanly using GCC,
produces the following error with clang++:

$ cat bug.cc
char* idx(char *s, int c) {
   return __builtin_index(s, c);

$ clang++ -fsyntax-only bug.cc
bug.cc:2:10: error: use of undeclared identifier '__builtin_index'
   return __builtin_index(s, c);
1 error generated.

Looking into include/clang/Builtins.def, we find

LIBBUILTIN(index, "c*cC*i", "f", "strings.h")
LIBBUILTIN(rindex, "c*cC*i", "f", "strings.h")

but there are no corresponding lines for __builtin_index and __builtin_rindex.

Enea Zaffanella.

added in r101858.