This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/56189] New: Infinite recursion with noexcept when instantiating function template


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

             Bug #: 56189
           Summary: Infinite recursion with noexcept when instantiating
                    function template
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: belz@kolumbus.fi


The following code:

namespace test {
   template<typename T>
   void tt(T&, T&);
}

template<typename T>
void tt(T& a, T& b) noexcept(noexcept(::test::tt(a,b)));

template<typename T>
void foo(T& x, T& y) noexcept(noexcept(tt(x, y)));

int main()
{
    int i;
    foo(i,i);
}

fails to compile with error:

Compilation finished with errors:
source.cpp:11:47: error: template instantiation depth exceeds maximum of 900
(use -ftemplate-depth= to increase the maximum) substituting 'template<class T>
void tt(T&, T&) [with T = <missing>]'
 void foo(T& x, T& y) noexcept(noexcept(tt(x, y)));
                                               ^
source.cpp:11:47:   recursively required from 'void tt(T&, T&) [with T = int]'
source.cpp:11:47:   required from 'void foo(T&, T&) [with T = int]'
source.cpp:16:12:   required from here

source.cpp:11:47: error: no matching function for call to 'tt(int&, int&)'
source.cpp:11:47: note: candidate is:
source.cpp:8:6: note: template<class T> void tt(T&, T&)
 void tt(T& a, T& b) noexcept(noexcept(::test::tt(a,b)));
      ^
source.cpp:8:6: note:   substitution of deduced template arguments resulted in
errors seen above


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]