[LLVMbugs] [Bug 19639] New: Overloaded function template instantiation with decltype recurses infinitely

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 2 10:23:02 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19639

            Bug ID: 19639
           Summary: Overloaded function template instantiation with
                    decltype recurses infinitely
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: default_357-line at yahoo.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

---- testcase ----
struct Number { };

template<typename T1, typename T2>
static int foo(T1&, T2&) { return 1; }

template<typename T1>
static auto foo(T1 &a, int) -> decltype(foo(a, *new Number())) { return foo(a,
*new Number()); }

int main() { return foo(*new Number(), 8); }

---- error ----
testcase.cpp:4:12: fatal error: recursive template instantiation exceeded
maximum depth of 256
static int foo(T1&, T2&) { return 1; }
           ^
testcase.cpp:7:13: note: while substituting deduced template arguments into
function template 'foo' [with T1 = Number]

The code works in g++ 4.8. It also works when declaring an explicit return
type.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140502/be6be832/attachment.html>


More information about the llvm-bugs mailing list