[cfe-dev] __builtin_index not recognized.

Enea Zaffanella zaffanella at cs.unipr.it
Sun Apr 18 14:51:18 PDT 2010


Hello.

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.

Regards,
Enea Zaffanella.



More information about the cfe-dev mailing list