#5702 crash: clang: test/Parser/cxx0x-member-initializers.cpp (bailout withn an internal error)
This commit is contained in:
parent
6f3e3f5e2e
commit
623e5db0b2
|
@ -432,6 +432,8 @@ bool CheckClass::isBaseClassFunc(const Token *tok, const Scope *scope)
|
|||
|
||||
void CheckClass::initializeVarList(const Function &func, std::list<const Function *> &callstack, const Scope *scope, std::vector<Usage> &usage)
|
||||
{
|
||||
if (!func.functionScope)
|
||||
throw InternalError(0, "Internal Error: Invalid syntax"); // #5702
|
||||
bool initList = func.isConstructor();
|
||||
const Token *ftok = func.arg->link()->next();
|
||||
int level = 0;
|
||||
|
|
|
@ -183,6 +183,7 @@ private:
|
|||
TEST_CASE(pureVirtualFunctionCallPrevented);
|
||||
|
||||
TEST_CASE(duplInheritedMembers);
|
||||
TEST_CASE(invalidInitializerList);
|
||||
}
|
||||
|
||||
void checkDuplInheritedMembers(const char code[]) {
|
||||
|
@ -1970,12 +1971,12 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:9]: (error) Class 'AA<double>' which is inherited by class 'B' does not have a virtual destructor.\n", errout.str());
|
||||
}
|
||||
|
||||
void checkNoConstructor(const char code[]) {
|
||||
void checkNoConstructor(const char code[], const char* level="style") {
|
||||
// Clear the error log
|
||||
errout.str("");
|
||||
|
||||
Settings settings;
|
||||
settings.addEnabled("style");
|
||||
settings.addEnabled(level);
|
||||
|
||||
// Tokenize..
|
||||
Tokenizer tokenizer(&settings, this);
|
||||
|
@ -5974,6 +5975,12 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void invalidInitializerList() {
|
||||
ASSERT_THROW(checkNoConstructor("struct R1 {\n"
|
||||
" int a;\n"
|
||||
" R1 () : a { }\n"
|
||||
"};\n", "warning"), InternalError);
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestClass)
|
||||
|
|
Loading…
Reference in New Issue