This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Dependency loop with templates


Perry Smith <pedz@easesoftware.com> writes:

> Sorry to be such a pest about this.  I still don't understand this
> two phase lookup.  Here is my logic:
> 
> StreamSize(v[i]) depends upon v[i] which depends upon std::vector<V>
> which depends upon V.  So, StreamSize does (according to my logic)
> depend upon the template argument.  Where did I go wrong?

In fact, I think you're right, and I'm wrong.  Sorry about that.

I think this may be a bug in the compiler.  Here is a reduced test
case:

class c;
template<typename T> class tm { public: const T& g() const; };
namespace n {
  template <class T> int fn(const tm<T> &v) { return fn(v.g());  }
  int fn(const c *p);
}
int main() { tm<c *> v; return n::fn(v); }

Interestingly, it works as expected without the namespace.

I'll file this as a bug report and see what happens.

Thanks for pushing on this.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]