<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - C++17 frontend segmentation"
href="https://bugs.llvm.org/show_bug.cgi?id=41243">41243</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>C++17 frontend segmentation
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++'17
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>d.j.bogan@outlook.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
Something todo with the "linkage" (static char const[]) in template function.
gcc trunk
In instantiation of 'constexpr std::make_integer_sequence<int, 3> keyCheck<5,
(& test1)>::idxs':
<source>:97:1: required from here
<source>:20:58: internal compiler error: in discriminator_for_local_entity, at
cp/mangle.c:1901
20 | static constexpr std::make_integer_sequence<int,N-2> idxs{};
| ^~~~
###
/*
* test.cpp
*/
###
#include <cassert>
#include <functional>
#include <iostream>
#include <sstream>
#include <string>
#include <type_traits>
#include <utility>
using namespace std::literals::string_literals;
template<int N,char const * key>
struct keyCheck {
static constexpr std::make_integer_sequence<int,N-2> idxs{};
template<typename T,template<typename,T...> class ls_t,T ...Idxs>
static bool check_helper(std::istream& is,ls_t<T,Idxs...> idxs){
char s;
return ( ... && ( is.get(s) && (s == key[Idxs]) ) );
}
static bool check(std::istream& is){
return keyCheck::check_helper(is,idxs);
}
};
static char const stest1[]{"test1"};
extern char const etest1[]{"test1"};
#define stringer(X) sizeof(X),X
template<typename T>
void test4(T z){
std::string s1{"test1"s};
std::stringstream ss1{s1};
assert(keyCheck<stringer(stest1)>::check(ss1));
}
template<typename T>
void test3(T z){
std::string s1{"test1"s};
std::stringstream ss1{s1};
assert(keyCheck<stringer(etest1)>::check(ss1));
}
void test2(int z){
static char const test1[]{"test"};
std::string s1{"test1"s};
std::stringstream ss1{s1};
assert(keyCheck<stringer(test1)>::check(ss1));
}
template<int=0>
void test5(){
static char const test1[]{"test"};
std::string s1{"test1"s};
std::stringstream ss1{s1};
assert(keyCheck<stringer(test1)>::check(ss1));
}
template<typename T>
void test(T z){
static char const test1[]{"test"};
std::string s1{"test1"s};
std::stringstream ss1{s1};
assert(keyCheck<stringer(test1)>::check(ss1));
}
int main(){
test(1);
test2(2);
test3(3);
test4(4);
test5();
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>