public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54318] New: [C++11] Bogus "template instantiation depth exceeds maximum" error + segfault
@ 2012-08-19 1:55 zeratul976 at hotmail dot com
2013-05-02 20:54 ` [Bug c++/54318] " zeratul976 at hotmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: zeratul976 at hotmail dot com @ 2012-08-19 1:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54318
Bug #: 54318
Summary: [C++11] Bogus "template instantiation depth exceeds
maximum" error + segfault
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: zeratul976@hotmail.com
The following code:
template <typename T>
struct wrapped
{
typedef T type;
};
template <typename T>
typename T::type unwrap1(T);
int unwrap(int);
template <typename T>
auto unwrap(T t) -> decltype(unwrap(unwrap1(t)))
{
return unwrap(unwrap1(t));
}
int main()
{
unwrap(wrapped<wrapped<int>>());
}
Seems to produce an infinite loop in GCC, as it displays the same error message
over and over again, and eventualy segfaults.
Here is the error message:
test.cpp:13:6: error: template instantiation depth exceeds maximum of 900 (use
-ftemplate-depth= to increase the maximum) substituting 'template<class T>
typename T::type unwrap1(T) [with T = wrapped<wrapped<int> >]'
auto unwrap(T t) -> decltype(unwrap(unwrap1(t)))
^
test.cpp:13:6: recursively required by substitution of 'template<class T>
decltype (unwrap(unwrap1(t))) unwrap(T) [with T = wrapped<int>]'
test.cpp:13:6: required by substitution of 'template<class T> decltype
(unwrap(unwrap1(t))) unwrap(T) [with T = wrapped<int>]'
test.cpp:15:29: template instantiation depth exceeds maximum of 900 (use
-ftemplate-depth= to increase the maximum) substituting 'template<class T>
typename T::type unwrap1(T) [with T = wrapped<wrapped<int> >]'
The last 3 lines are repeated thousands of times until finally:
g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
I believe the code is valid. Clang compiles it without errors.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/54318] [C++11] Bogus "template instantiation depth exceeds maximum" error + segfault
2012-08-19 1:55 [Bug c++/54318] New: [C++11] Bogus "template instantiation depth exceeds maximum" error + segfault zeratul976 at hotmail dot com
@ 2013-05-02 20:54 ` zeratul976 at hotmail dot com
2013-05-03 9:20 ` paolo.carlini at oracle dot com
2013-05-03 9:37 ` paolo.carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: zeratul976 at hotmail dot com @ 2013-05-02 20:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54318
Nathan Ridge <zeratul976 at hotmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|4.8.0 |4.7.3
--- Comment #1 from Nathan Ridge <zeratul976 at hotmail dot com> 2013-05-02 20:54:17 UTC ---
This seems to be fixed in the 4.8.0 release.
Should I keep the bug open so it might be fixed in the 4.7 series?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/54318] [C++11] Bogus "template instantiation depth exceeds maximum" error + segfault
2012-08-19 1:55 [Bug c++/54318] New: [C++11] Bogus "template instantiation depth exceeds maximum" error + segfault zeratul976 at hotmail dot com
2013-05-02 20:54 ` [Bug c++/54318] " zeratul976 at hotmail dot com
@ 2013-05-03 9:20 ` paolo.carlini at oracle dot com
2013-05-03 9:37 ` paolo.carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-03 9:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54318
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-05-03 09:20:10 UTC ---
Too late for 4.7.x, but let me add the testcase to the testsuite, to be safe.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/54318] [C++11] Bogus "template instantiation depth exceeds maximum" error + segfault
2012-08-19 1:55 [Bug c++/54318] New: [C++11] Bogus "template instantiation depth exceeds maximum" error + segfault zeratul976 at hotmail dot com
2013-05-02 20:54 ` [Bug c++/54318] " zeratul976 at hotmail dot com
2013-05-03 9:20 ` paolo.carlini at oracle dot com
@ 2013-05-03 9:37 ` paolo.carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-03 9:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54318
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Known to work| |4.8.0, 4.9.0
Resolution| |FIXED
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-05-03 09:37:35 UTC ---
Done.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-03 9:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-19 1:55 [Bug c++/54318] New: [C++11] Bogus "template instantiation depth exceeds maximum" error + segfault zeratul976 at hotmail dot com
2013-05-02 20:54 ` [Bug c++/54318] " zeratul976 at hotmail dot com
2013-05-03 9:20 ` paolo.carlini at oracle dot com
2013-05-03 9:37 ` paolo.carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).