[cfe-dev] clang c++ inheritance

John McCall rjmccall at apple.com
Sun Jan 27 13:57:36 PST 2013


On Jan 27, 2013, at 1:40 PM, Mohammad Adil <madil90 at gmail.com> wrote:
> What do you mean by "in non-dependent contexts"?

Within a template, a class may have a base class that depends
on the template arguments.  If you don't know what I mean by that,
you may need to do more research into C++ before writing your tool.

> And what is meant by "sugared"?

In programming language design, we generally use the word "sugar" to
mean some sort of language feature that isn't strictly necessary, but
which makes something easier or more convenient to express.

In C and C++, typedefs are the most obvious example of type sugar,
but things like explicit scope specifiers ("std::") and elaborated type
specifiers ("struct vector") also count.

Basically, I'm saying that, on a valid class outside of a template, you
can safely call castAs<RecordType>() on a base type.

John.



More information about the cfe-dev mailing list