[Bug c++/55581] New: Too-eager instantiation
dave at boostpro dot com
gcc-bugzilla@gcc.gnu.org
Mon Dec 3 22:11:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55581
Bug #: 55581
Summary: Too-eager instantiation
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: dave@boostpro.com
IMO this program should compile with -ftemplate-depth=1, as it does on Clang.
[Sorry for the inline code; technical difficulties prevent me from adding an
attachment before I reboot my machine]
template <long N>
struct mooch
{
struct arrow
{
mooch<N-1> operator->();
};
arrow operator->();
};
template <>
struct mooch<0>
{
int x;
mooch<0>* operator->();
};
mooch<10000> a; // compiles with -ftemplate-depth 1
decltype(a.operator->()) y; // compiles with -ftemplate-depth 1
decltype(a->x) z; // requires -ftemplate-depth=20000 on g++ but not
on clang++
More information about the Gcc-bugs
mailing list