Index: lib/AST/Decl.cpp =================================================================== --- lib/AST/Decl.cpp +++ lib/AST/Decl.cpp @@ -2732,6 +2732,12 @@ if (getStorageClass() == SC_Static) return 0; + // According to OpenCL v1.2 s6.9.f, the library functions defined in + // the C99 standard headers are not available. + if (Context.getLangOpts().OpenCL && + Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID)) + return 0; + return BuiltinID; } Index: test/SemaOpenCL/printf.cl =================================================================== --- /dev/null +++ test/SemaOpenCL/printf.cl @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only +// expected-no-diagnostics + +typedef float float4 __attribute__((ext_vector_type(4))); +int printf(__constant const char* st, ...); + +void test(void) +{ + float4 a; + printf("%8.4v4hlf\n", a); +}