[cfe-dev] Typeid and forward declaration - Clarification needed

Rahul Jain 1989.rahuljain at gmail.com
Tue Oct 29 01:29:56 PDT 2013


Hi all,

This is with respect to the following TC.

struct S;

template <typename T>
static bool fn (S *s)
{
  return typeid (*s) == typeid (T);
}

struct S
{
};

bool x = fn<S> (__null);


The standard says:
If the type of the type-id is a class type or a reference to a class type,
the class shall be completely-defined.


This "shall" is kind of confusing. Is this a valid TC. Is forward
declaration allowed while using the typeid operator?

Any clarification on the same would be appreciated.

Thanks,
Rahul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131029/7271605b/attachment.html>


More information about the cfe-dev mailing list