What is placeholder type?


I’m currently diving into C++ standard and clang frontend, only to be confused by the definition of placeholder type.

In clang, the placeholder type contains so many definition, to name a few: OMPArraySection, BoundMember, ARCUnbridgedCast, which is totally different from what it is in C++ standard (

So, my problem is: what is placeholder type in clang ? What is the philosophy behind it ? Why does it differ from the definition in C++ standard ?

Thanks for reading my question :slight_smile:

“Placeholder” types in clang are used to represent the type of an expression where the semantics depend on the context. So it’s a placeholder in the sense that we don’t know the type yet. For example, in C++, if you refer to an overloaded function, the type of the expression depends on overload resolution (and when we construct the expression, that hasn’t happened yet).

It’s not related to the C++ standard definition; just an unfortunate name collision. clang calls that an AutoType. (I think the clang type got its name before the C++ standard starting using the term “placeholder”.)

1 Like

Thanks ! Your explanation is really helpful to me :slight_smile: