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: unassignedclangb...@nondot.org
          Reporter: mschwa...@gmail.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to