[cfe-dev] const stripped in typedefs for parameters of primitive type?

Jacob Carlborg doob at me.com
Sat Aug 23 04:01:11 PDT 2014


I have a tool that does some processing on C code using libclang. I 
recently found out that it seems libclang strips const in typedefs for 
parameters of primitive type. Example:

typedef void (*foo)(const char* a, const int b);
void (*bar)const char* c, const int d);

According libclang, in "foo", "a" is const but "b" is not const. But in 
"bar", both "c" and "d" are const.

Is this how C behaves, or have I made an mistake how the tool handles 
typedefs. Or is this a bug in libclang?

I have tried with both libclang 3.1 and 3.5-rc3

-- 
/Jacob Carlborg




More information about the cfe-dev mailing list