Recursive template instantiation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

I have a question about test case in pr60687:

template <typename CALLER>
void exec1(CALLER & caller) {
  struct Me : public CALLER {
  public:
    Me(CALLER & caller) : CALLER(caller) {};
    void exec() {
      if(0) exec1(*this);
    }
  } me(caller);
  return me.exec();
}

int main(int, char**) {
  struct Me0 {} me;
  exec1(me);
  return 0;
}

Currently gcc fails to compile it with 'template
instantiation depth exceeds maximum' error

But actually exec1 is not recursive, so we dont need
to instantiate all these templates.

So the question is:
  Is this behavior valid? Or maybe according to C++11
standard we should be able to compile and run such code.


-- 
BR,
Usishchev Yury




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux