fix daca2 paraview crash from uninstantiated recursive template (#3237)
This commit is contained in:
parent
9aa131a12e
commit
e1e822275d
|
@ -1871,6 +1871,9 @@ namespace {
|
|||
// check in base types base types
|
||||
for (const std::string & base : baseTypes) {
|
||||
const ScopeInfo3 * baseScope = findScope(base);
|
||||
// bail on uninstantiated recursive template
|
||||
if (baseScope == this)
|
||||
return false;
|
||||
if (baseScope && baseScope->fullName == scope)
|
||||
return true;
|
||||
if (baseScope && baseScope->findTypeInBase(scope))
|
||||
|
|
|
@ -71,6 +71,7 @@ private:
|
|||
TEST_CASE(simplifyUsing22);
|
||||
TEST_CASE(simplifyUsing23);
|
||||
TEST_CASE(simplifyUsing24);
|
||||
TEST_CASE(simplifyUsing25);
|
||||
|
||||
TEST_CASE(simplifyUsing8970);
|
||||
TEST_CASE(simplifyUsing8971);
|
||||
|
@ -593,6 +594,24 @@ private:
|
|||
ASSERT_EQUALS(expected, tok(code, false));
|
||||
}
|
||||
|
||||
void simplifyUsing25() {
|
||||
const char code[] = "struct UnusualType {\n"
|
||||
" using T = vtkm::Id;\n"
|
||||
" T X;\n"
|
||||
"};\n"
|
||||
"namespace vtkm {\n"
|
||||
"template <>\n"
|
||||
"struct VecTraits<UnusualType> : VecTraits<UnusualType::T> { };\n"
|
||||
"}";
|
||||
const char expected[] = "struct UnusualType { "
|
||||
"vtkm :: Id X ; "
|
||||
"} ; "
|
||||
"namespace vtkm { "
|
||||
"struct VecTraits<UnusualType> : VecTraits < vtkm :: Id > { } ; "
|
||||
"}";
|
||||
ASSERT_EQUALS(expected, tok(code, false));
|
||||
}
|
||||
|
||||
void simplifyUsing8970() {
|
||||
const char code[] = "using V = std::vector<int>;\n"
|
||||
"struct A {\n"
|
||||
|
|
Loading…
Reference in New Issue