__uuidof and template arguments

Hello all,

It seems like our __uuidof implementation has some interesting quirks.

We currently allow:

struct __declspec(uuid("{12345678-1234-1234-1234-1234567890ab}")) uuid;

struct _GUID;
template <float *>
struct thing {};

thing<__uuidof(uuid)> x;

__uuidof is treated as a bit of a celebrity in some areas in clang and I believe it’s special treatment makes it easier for gaps like these to show up.

I don’t know what’s the best thing to do here but I see two obvious choices:

  1. We continue treating __uuidof as a special thing, making CheckTemplateArgumentAddressOfObjectOrFunction smarter, etc.
  2. We change the way we semantically model the keyword/operator so that instead of a specially handled operand, we have a DeclRefExpr like CheckTemplateArgumentAddressOfObjectOrFunction would normally expect.