[llvm-bugs] [Bug 48839] New: Passing templated function-local class as template parameter causes infinite recursion in instantiation

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 21 14:57:01 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=48839

            Bug ID: 48839
           Summary: Passing templated function-local class as template
                    parameter causes infinite recursion in instantiation
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mital.vaja at googlemail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

The following compiles with gcc but does not with clang:

    template<typename T>
    void construct() {
        T(0);
    }

    template<typename T>
    void tester() {
        struct d {
            void test() {
                construct<d>();
            }
            constexpr d(T b) : a(b) {}
            T a;
        };
    }

    int main() {
        tester<int>();
    }


link: https://godbolt.org/z/jd41rr

It fails with "fatal error: recursive template instantiation exceeded maximum
depth of 1024"

-- 
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/20210121/97df8b57/attachment.html>


More information about the llvm-bugs mailing list