[llvm-bugs] [Bug 41939] New: Frontend crash due to infinite template recursion

via llvm-bugs llvm-bugs at lists.llvm.org
Mon May 20 01:31:53 PDT 2019


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

            Bug ID: 41939
           Summary: Frontend crash due to infinite template recursion
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mschwar42 at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

The following (non-valid) C++ snippet causes clang version 8.0 to crash:

// compiled using clang++ test.cpp

#include <iostream>
#include <vector>

template <typename C,
    typename std::enable_if_t<std::is_same<decltype(std::ostream() <<
C()),std::ostream&>::value, int> = 0>
std::ostream& operator<<(std::ostream& o, const C& container){
    for(const auto& i : container){
        o << i;
        o << " ";
    }
    return o;
}


int main(){
    std::vector<int> vec = {1,2,3,4};
    std::cout<<vec<<std::endl;
}


clang-8: error: unable to execute command: Segmentation fault (core dumped)
clang-8: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 8.0.0 (tags/RELEASE_800/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

-- 
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/20190520/c926d51b/attachment-0001.html>


More information about the llvm-bugs mailing list