Skip to content

Commit 12cc101

Browse files
committed
IRGen: use the llvm::TrailingObjects base class explicitly
Visual Studio is unable to follow the inheritance to find the method and objects with: lib\IRGen\GenExistential.cpp(153): error C2903: 'totalSizeToAlloc': symbol is neither a class template nor a function template lib\IRGen\GenExistential.cpp(153): note: This diagnostic occurred in the compiler generated function 'const Derived *`anonymous-namespace'::ExistentialTypeInfoBase<Derived,Base>::create(llvm::ArrayRef<T>,As &&...)' with [ T=const swift::ProtocolDecl * ] lib\IRGen\GenExistential.cpp(202): note: see reference to class template instantiation '`anonymous-namespace'::ExistentialTypeInfoBase<Derived,Base>' being compiled lib\IRGen\GenExistential.cpp(154): error C2760: syntax error: unexpected token 'const', expected 'expression' lib\IRGen\GenExistential.cpp(154): note: This diagnostic occurred in the compiler generated function 'const Derived *`anonymous-namespace'::ExistentialTypeInfoBase<Derived,Base>::create(llvm::ArrayRef<T>,As &&...)' with [ T=const swift::ProtocolDecl * ]
1 parent 6aae40c commit 12cc101

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/IRGen/GenExistential.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ namespace {
150150
create(ArrayRef<const ProtocolDecl *> protocols, As &&...args)
151151
{
152152
void *buffer = operator new(
153-
ExistentialTypeInfoBase::template totalSizeToAlloc<
154-
const ProtocolDecl *>(protocols.size()));
153+
llvm::TrailingObjects<Derived, const ProtocolDecl *>::
154+
template totalSizeToAlloc<const ProtocolDecl *>(
155+
protocols.size()));
155156
return new (buffer) Derived(protocols, std::forward<As>(args)...);
156157
}
157158

0 commit comments

Comments
 (0)