[cfe-commits] r147730 - in /cfe/trunk: include/clang/Sema/Sema.h lib/CodeGen/CodeGenFunction.cpp lib/Parse/ParseDecl.cpp lib/Sema/SemaDecl.cpp test/CodeGen/vla.c

Eli Friedman eli.friedman at gmail.com
Sat Jan 7 16:30:23 PST 2012


On Sat, Jan 7, 2012 at 3:17 PM, Abramo Bagnara <abramo.bagnara at gmail.com> wrote:
> Il 07/01/2012 21:33, Douglas Gregor ha scritto:
>>
>> On Jan 7, 2012, at 2:52 AM, Abramo Bagnara wrote:
>>> +    default:
>>> +      // Only sugared types (different from typeof_expr) can reach this point.
>>> +      assert(!type.isCanonical() && "unhandled canonical type!");
>>> +      type = type.getSingleStepDesugaredType(getContext());
>>> +      break;
>>> +
>>> +    case Type::TypeOfExpr: {
>>> +      // This is the only sugared type requiring special treatment.
>>> +      // Emit typeof expression and we are done.
>>> +      Expr *E = cast<TypeOfExprType>(ty)->getUnderlyingExpr();
>>> +      EmitIgnoredExpr(E);
>>> +      return;
>>> +    }
>>
>> Do you also need to handle decltype?
>
> In C++11 7.1.6.2p4 it is written "The operand of the decltype specifier
> is an unevaluated operand".
>
> But it is also true that C++11 does not have VLA (and therefore does not
> take in account them).
>
> gcc 4.6.1 obey C++11 7.1.6.2p4 also for VM types.

How can you tell?

> IMHO it is better to avoid code generation for decltype, but I'd like to
> hear your opinion about that.

decltype isn't substantially different from typeof in this context...
so we might as well handle it.

-Eli




More information about the cfe-commits mailing list