Index: lib/Sema/SemaType.cpp =================================================================== --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -4366,7 +4366,7 @@ FunctionType::ExtInfo EI(getCCForDeclaratorChunk(S, D, FTI, chunkIndex)); - if (!FTI.NumParams && !FTI.isVariadic && !LangOpts.CPlusPlus) { + if (!FTI.NumParams && !FTI.isVariadic && !LangOpts.CPlusPlus && !LangOpts.OpenCL) { // Simple void foo(), where the incoming T is the result type. T = Context.getFunctionNoProtoType(T, EI); } else { Index: test/SemaOpenCL/function-no-args.cl =================================================================== --- /dev/null +++ test/SemaOpenCL/function-no-args.cl @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -verify -pedantic -fsyntax-only -cl-std=CL2.0 %s +// expected-no-diagnostics + +global int gi; +int my_func(); +int my_func() { + gi = 2; + return gi; +}