Summary: | operator-> in a template class can lead to infinite template instantiation | ||
---|---|---|---|
Product: | gcc | Reporter: | Vasily Sukhanov <basil> |
Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | jakub |
Priority: | P3 | ||
Version: | 4.6.3 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: |
Description
Vasily Sukhanov
2013-02-25 22:38:36 UTC
Both 4.7 and 4.8 exit with a sensible diagnostic: a.cc:2:19: error: template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum) instantiating ‘Loop<T*> Loop<T>::operator->() [with T = int************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************]’ a.cc:2:19: recursively required from ‘Loop<T*> Loop<T>::operator->() [with T = int]’ a.cc:2:19: required from here a.cc:2:19: error: template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum) instantiating ‘struct Loop<int*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************>’ a.cc:2:19: recursively required from ‘Loop<T*> Loop<T>::operator->() [with T = int]’ a.cc:2:19: required from here a.cc:2:19: error: invalid use of incomplete type ‘struct Loop<int*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************>’ a.cc:1:26: error: declaration of ‘struct Loop<int*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************>’ |