Objective-C++11 literal types

Hi,

I was surprised to find this in AST::Type::isLiteralType:

  // Objective-C lifetime types are not literal types.
  if (BaseTy->isObjCRetainableType())
    return false;

This is strange, because we do support constant expression evaluation of
Objective-C lifetime types (outside C++11).

So which is correct? Should lifetime types be permitted as literal types, or
should they not be permitted as the type of globals in (Objective-)C? Or is
there some reason why C++11 should treat them differently from other
languages?

Thanks,
Richard

I don't know the reasoning for that change, but I would assume it's
supposed to apply to ownership-qualified types under ARC, i.e.
types with a non-trivial ObjCLifetime qualifier, because such types
generally require extra operations which need to be performed at
runtime. However, I don't know that that's actually correct, because
any object of such a type that can be constant-evaluated must also
be statically allocated, which means that retains and releases can
be completely ignored. That might be a lot of complexity to get right,
though.

John.

We allow these types to be subject to constant initialization in (Objective-)
C and C++98 already. If there is extra complexity, handling it in a
C++11-specific fashion seems wrong unless the complexity is C++11-specific --
which I don't think it is. Any objection to my removing this check?

Richard

No objection. I (incorrectly) added this check a while ago, thinking that we wouldn't ever be able to do constant-evaluation for ownership-qualified types under ARC.

  - Doug