[cfe-dev] clang doesn't compile simple code

fprijate prijatelj.francek at gmail.com
Mon Apr 21 03:05:15 PDT 2014


Hi

Here is a sample code :

typedef int (_cdecl * func1 )( void );
typedef int (_stdcall * func2 )( void );

which clang doesn't compile.
Actually it compiles it on Win with compiler from   Windows snapshot builds
<http://llvm.org/builds/>  
While on Ubuntu (apt-get ...) or on Windows  pacman from MSYS2
<http://sourceforge.net/projects/msys2/>   doesn,t compile.

Problem is:
While gcc preprocesor (mingw on win32 or gcc on linux) translates code to

typedef int (__attribute__((__cdecl__)) * func1 )( void );
typedef int (__attribute__((__stdcall__)) * func2 )( void );

and then translates it to object file, clang preprocesor lives code as it is
and then throws error.

Solutuion:
If i explicitly change source code to:

typedef int (__attribute__((__cdecl__)) * func1 )( void );
typedef int (__attribute__((__stdcall__)) * func2 )( void );

and then compile it with clang , it compiles OK.

regards
FranĨek




 



--
View this message in context: http://clang-developers.42468.n3.nabble.com/clang-doesn-t-compile-simple-code-tp4038903.html
Sent from the Clang Developers mailing list archive at Nabble.com.




More information about the cfe-dev mailing list