diff options
Diffstat (limited to 'test/Analysis/cxx11-crashes.cpp')
-rw-r--r-- | test/Analysis/cxx11-crashes.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Analysis/cxx11-crashes.cpp b/test/Analysis/cxx11-crashes.cpp index d0b9222b6a66..3c33de33558f 100644 --- a/test/Analysis/cxx11-crashes.cpp +++ b/test/Analysis/cxx11-crashes.cpp @@ -65,3 +65,32 @@ bool begin(double *it) { bool *a = reinterpret_cast<type &>(*( reinterpret_cast<char *>( it ))); return *a; } + +// radar://14164698 Don't crash on "assuming" a ComoundVal. +class JSONWireProtocolInputStream { +public: + virtual ~JSONWireProtocolInputStream(); +}; +class JSONWireProtocolReader { +public: + JSONWireProtocolReader(JSONWireProtocolInputStream& istream) + : _istream{istream} {} // On evaluating a bind here, + // the dereference checker issues an assume on a CompoundVal. +~JSONWireProtocolReader(); +private: +JSONWireProtocolInputStream& _istream; +}; +class SocketWireProtocolStream : public JSONWireProtocolInputStream { +}; +void test() { + SocketWireProtocolStream stream{}; + JSONWireProtocolReader reader{stream}; +} + +// This crashed because the analyzer did not understand AttributedStmts. +void fallthrough() { + switch (1) { + case 1: + [[clang::fallthrough]]; + } +} |