[llvm-bugs] [Bug 35835] New: Crash on aggregate initialization of a struct containing members inherited from std::vector

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 5 11:35:06 PST 2018


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

            Bug ID: 35835
           Summary: Crash on aggregate initialization of a struct
                    containing members inherited from std::vector
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sobols at yandex-team.ru
                CC: llvm-bugs at lists.llvm.org

Created attachment 19635
  --> https://bugs.llvm.org/attachment.cgi?id=19635&action=edit
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 https://llvm.org/svn/llvm-project/libcxx/trunk@$rev libcxx-r$rev

-- 
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/20180105/aef51754/attachment.html>


More information about the llvm-bugs mailing list