public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56449] New: operator-> in a template class can lead to infinite template instantiation
@ 2013-02-25 22:38 basil at list dot ru
  2013-02-25 22:42 ` [Bug c++/56449] " redi at gcc dot gnu.org
  2013-02-25 22:45 ` jakub at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: basil at list dot ru @ 2013-02-25 22:38 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56449

             Bug #: 56449
           Summary: operator-> in a template class can lead to infinite
                    template instantiation
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: basil@list.ru


Code example:

template<class T> struct Loop { Loop<T*> operator->(); };
Loop<int> i, j = i->something;

The compiler doesn't diagnose infinite Loop<> instantiation. Even CLI option
ftemplate-depth=n doesn't help.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/56449] operator-> in a template class can lead to infinite template instantiation
  2013-02-25 22:38 [Bug c++/56449] New: operator-> in a template class can lead to infinite template instantiation basil at list dot ru
@ 2013-02-25 22:42 ` redi at gcc dot gnu.org
  2013-02-25 22:45 ` jakub at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2013-02-25 22:42 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56449

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-25 22:42:12 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*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************>’


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/56449] operator-> in a template class can lead to infinite template instantiation
  2013-02-25 22:38 [Bug c++/56449] New: operator-> in a template class can lead to infinite template instantiation basil at list dot ru
  2013-02-25 22:42 ` [Bug c++/56449] " redi at gcc dot gnu.org
@ 2013-02-25 22:45 ` jakub at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-02-25 22:45 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56449

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|                            |DUPLICATE

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-25 22:45:10 UTC ---
Dup of PR49118.

*** This bug has been marked as a duplicate of bug 49118 ***


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-25 22:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-25 22:38 [Bug c++/56449] New: operator-> in a template class can lead to infinite template instantiation basil at list dot ru
2013-02-25 22:42 ` [Bug c++/56449] " redi at gcc dot gnu.org
2013-02-25 22:45 ` jakub at gcc dot gnu.org

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).