Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpptypes: Adjust the aggregate type of a template specialization type #1

Merged
merged 3 commits into from
Feb 19, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion dmd2/cpp/cpptypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,9 @@ Type* TypeMapper::FromType::fromTypeTemplateSpecialization(const clang::Template

if (T->isSugared())
{
// NOTE: To reduce DMD -> Clang translations to a minimum we don't instantiate ourselves whenever possible, i.e when the template instance is already declared or defined in the PCH. If it's only declared, there's a chance the specialization wasn't emitted in the C++ libraries, so we tell Sema to complete its instantiation.
// NOTE: To reduce DMD -> Clang translations to a minimum we don't instantiate ourselves whenever possible, i.e when
// the template instance is already declared or defined in the PCH. If it's only declared, there's a chance the specialization
// wasn't emitted in the C++ libraries, so we tell Sema to complete its instantiation.

auto RT = T->getAs<clang::RecordType>();

Expand All @@ -853,7 +855,15 @@ Type* TypeMapper::FromType::fromTypeTemplateSpecialization(const clang::Template
}

if (!T->isTypeAlias())
{
if (!RT)
{
auto ICNT = T->castAs<clang::InjectedClassNameType>();
return adjustAggregateType(tqual, ICNT->getDecl());
}

return adjustAggregateType(tqual, RT->getDecl());
}
}

return adjustAggregateType(tqual);
Expand Down