cppast icon indicating copy to clipboard operation
cppast copied to clipboard

Typedefs of element type in pointer/reference to array are ignored

Open foonathan opened this issue 8 years ago • 0 comments

  • cppast version: latest one
  • parser: libclang_parser
  • clang version: 3.9.1+

When having a pointer/reference to an array, the element type of the array will ignore typedefs and return the underlying type as element type instead. This is due to a libclang workaround that requires a call to clang_getCanonicalType() on the array type returned by a call to clang_getPointeeType(); otherwise clang_getElementType() won't work. But clang_getCanonicalType() strips away all typedefs, so they can't be exposed.

Input:

using foo = int;
using type = foo(&)[10];

Element type of the array will be a plain int, not foo.

foonathan avatar Apr 18 '17 13:04 foonathan