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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to