[cfe-dev] Clang bug, temp.res p8, or something else?

Kenneth Camann via cfe-dev cfe-dev at lists.llvm.org
Fri Jun 22 19:40:19 PDT 2018


gcc accepts the following, but clang does not:

template <typename T>
class Container {
  class iterator;

  void method(iterator);

  void convenienceMethod(iterator n) { method(++n); }
}

Clang says that Container::iterator is an incomplete type. The situation
seems similar to this:
http://clang.llvm.org/compatibility.html#undep_incomplete

except in this case, the type is nested inside the template, which I had
hoped would make the method body be ignored until instantiation (as in gcc).

My understanding is that since Container::iterator is part of the current
instantiation, it is not considered a dependent type, so clang is correct
by temp.res 8.5.1 and I should not open a bug report.

...but this is nice syntax when implementing containers, so I hope I am
wrong.

Thanks,
Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180622/df129650/attachment.html>


More information about the cfe-dev mailing list