<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 - Crash on aggregate initialization of a struct containing members inherited from std::vector"
href="https://bugs.llvm.org/show_bug.cgi?id=35835">35835</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Crash on aggregate initialization of a struct containing members inherited from std::vector
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>5.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sobols@yandex-team.ru
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=19635" name="attach_19635" title="crash backtrace">attachment 19635</a> <a href="attachment.cgi?id=19635&action=edit" title="crash backtrace">[details]</a></span>
crash backtrace
=== Description ===
clang C++ compiler together with fresh libc++ r321000 crashes when compiling a
simple program.
There is a class TVector inherited from std::vector, a struct TData having two
members of class TVector, a function that creates a default TData instance
using empty aggregate initializer.
=== main.cpp ===
#include <vector>
template <class T>
class TVector: public std::vector<T> {
public:
TVector() {
}
};
struct TData {
TVector<int> A;
TVector<int> B;
};
TData MakeEmptyData() {
return {};
}
int main() {
TData data = MakeEmptyData();
return 0;
}
=== Command line ===
$ clang++-5.0 main.cpp -std=c++11 -nostdinc++ -I libcxx-r321000/include/
=== Notes ===
The code does not cause a crash if any of the following changes is made.
* Any of the two struct members is removed. One TVector compiles fine, but two
TVectors do not.
* TVector member type is changed to std::vector.
* "return {};" is changed to "return TData{};".
=== Software Versions ===
OS Ubuntu 16.04.3 LTS x64 (with all up-to-date patches)
clang++-5.0 is installed from the official repository
$ clang++-5.0 --version
clang version 5.0.0-3~16.04.1 (tags/RELEASE_500/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
libc++ C++ Standard Library is taken from SVN repository
$ rev=321000
$ svn export <a href="https://llvm.org/svn/llvm-project/libcxx/trunk@$rev">https://llvm.org/svn/llvm-project/libcxx/trunk@$rev</a> libcxx-r$rev</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>