[LLVMbugs] [Bug 19517] New: Unexpected template recursion limit hit for constexpr function template

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 22 20:00:01 PDT 2014


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

            Bug ID: 19517
           Summary: Unexpected template recursion limit hit for constexpr
                    function template
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kariya_mitsuru at hotmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The sample code below causes a fatal error.

========================================
template<typename T>
constexpr T f(T const&);

template<typename T>
constexpr T g(T const& val) {
    return val >= 10 ? val : f(val + 1);
}

template<typename T>
constexpr T f(T const& val) {
    return g(val);
}

int main() {
    return f(0);
}
========================================

I think that this code should be compiled successfully.

Note that this code is compiled successfully if these functions are not
constexpr function.
(e.g. removing "constexpr" specifier from the function g)

I suspect that this is caused by bug 16008.

c.f.
http://melpon.org/wandbox/permlink/LVfTzRBLPLsKweNG

-- 
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/20140423/7c5cfb2c/attachment.html>


More information about the llvm-bugs mailing list