swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.27k stars 10.33k forks source link

[SR-8958] swift-reflection-dump.cpp fails to compile with clang 7.0.0 #51463

Closed 6d44b555-049a-4a81-86f1-5537312bcad6 closed 5 years ago

6d44b555-049a-4a81-86f1-5537312bcad6 commented 5 years ago
Previous ID SR-8958
Radar None
Original Reporter @kevints
Type Bug
Status Resolved
Resolution Done
Environment swift-4.2-RELEASE Ubuntu 14.04 Clang 7.0.0 from releases.llvm.org clang version 7.0.0 (tags/RELEASE_700/final) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/bin
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, Reflection | |Assignee | None | |Priority | Medium | md5: 11429fe354d7cdcd9b0cb70edda4d75f

Issue Description:

This file compiles fine with clang 6.0.0, but fails on clang 7.0.0 with the following errors:

$CC++ -DCMARK_STATIC_DEFINE -DGTEST_HAS_RTTI=0 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/swift-reflection-dump -I/code/workspace/swift/tools/swift-reflection-dump -Iinclude -I/code/workspace/swift/include -I/code/workspace/llvm/include -I/code/.build-Linux/workspace/linux-server-platform-x86_64/llvm-linux-x86_64/include -I/code/.build-Linux/workspace/linux-server-platform-x86_64/llvm-linux-x86_64/tools/clang/include -I/code/workspace/llvm/tools/clang/include -I/code/workspace/cmark/src -I/code/.build-Linux/workspace/linux-server-platform-x86_64/cmark-linux-x86_64/src -Wno-unknown-warning-option -Werror=unguarded-availability-new -fno-stack-protector -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fcolor-diagnostics -ffunction-sections -fdata-sections -Werror=switch -Wdocumentation -Wimplicit-fallthrough -Wunreachable-code -Woverloaded-virtual -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -O3    -UNDEBUG  -fno-exceptions -fno-rtti -target x86_64-unknown-linux-gnu -O2 -g0 -UNDEBUG -DSWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS -MD -MT tools/swift-reflection-dump/CMakeFiles/swift-reflection-dump.dir/swift-reflection-dump.cpp.o -MF tools/swift-reflection-dump/CMakeFiles/swift-reflection-dump.dir/swift-reflection-dump.cpp.o.d -o tools/swift-reflection-dump/CMakeFiles/swift-reflection-dump.dir/swift-reflection-dump.cpp.o -c /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:192:5: error: 'BuiltinTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, BuiltinTypeRef, MangledName);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:51:51: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  const auto Entry = Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.find(ID);       \
                                                  ^
<scratch space>:144:1: note: expanded from here
BuiltinTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:209:28: note: in instantiation of function template specialization 'swift::reflection::BuiltinTypeRef::create<swift::reflection::TypeRefBuilder>' requested here
    return BuiltinTypeRef::create(*this, mangledName);
                           ^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:19:1: note: declared as a non-template here
TYPEREF(Builtin, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:120:1: note: expanded from here
BuiltinTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:192:5: error: 'BuiltinTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, BuiltinTypeRef, MangledName);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:56:32: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.insert({ID, TR});                  \
                               ^
<scratch space>:146:1: note: expanded from here
BuiltinTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:19:1: note: declared as a non-template here
TYPEREF(Builtin, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:120:1: note: expanded from here
BuiltinTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:254:5: error: 'NominalTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, NominalTypeRef, MangledName, Parent);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:51:51: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  const auto Entry = Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.find(ID);       \
                                                  ^
<scratch space>:147:1: note: expanded from here
NominalTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:228:28: note: in instantiation of function template specialization 'swift::reflection::NominalTypeRef::create<swift::reflection::TypeRefBuilder>' requested here
    return NominalTypeRef::create(*this, *mangledName, nullptr);
                           ^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:20:1: note: declared as a non-template here
TYPEREF(Nominal, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:122:1: note: expanded from here
NominalTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:254:5: error: 'NominalTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, NominalTypeRef, MangledName, Parent);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:56:32: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.insert({ID, TR});                  \
                               ^
<scratch space>:149:1: note: expanded from here
NominalTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:20:1: note: declared as a non-template here
TYPEREF(Nominal, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:122:1: note: expanded from here
NominalTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:289:5: error: 'BoundGenericTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, BoundGenericTypeRef, MangledName, GenericParams,
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:51:51: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  const auto Entry = Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.find(ID);       \
                                                  ^
<scratch space>:150:1: note: expanded from here
BoundGenericTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:240:33: note: in instantiation of function template specialization 'swift::reflection::BoundGenericTypeRef::create<swift::reflection::TypeRefBuilder>' requested here
    return BoundGenericTypeRef::create(*this, *mangledName, args, nullptr);
                                ^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:21:1: note: declared as a non-template here
TYPEREF(BoundGeneric, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:124:1: note: expanded from here
BoundGenericTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:289:5: error: 'BoundGenericTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, BoundGenericTypeRef, MangledName, GenericParams,
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:56:32: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.insert({ID, TR});                  \
                               ^
<scratch space>:152:1: note: expanded from here
BoundGenericTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:21:1: note: declared as a non-template here
TYPEREF(BoundGeneric, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:124:1: note: expanded from here
BoundGenericTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:324:5: error: 'TupleTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, TupleTypeRef, Elements, Variadic);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:51:51: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  const auto Entry = Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.find(ID);       \
                                                  ^
<scratch space>:153:1: note: expanded from here
TupleTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:255:26: note: in instantiation of function template specialization 'swift::reflection::TupleTypeRef::create<swift::reflection::TypeRefBuilder>' requested here
    return TupleTypeRef::create(*this, elements, isVariadic);
                         ^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:22:1: note: declared as a non-template here
TYPEREF(Tuple, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:126:1: note: expanded from here
TupleTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:324:5: error: 'TupleTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, TupleTypeRef, Elements, Variadic);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:56:32: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.insert({ID, TR});                  \
                               ^
<scratch space>:155:1: note: expanded from here
TupleTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:22:1: note: declared as a non-template here
TYPEREF(Tuple, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:126:1: note: expanded from here
TupleTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:370:5: error: 'FunctionTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, FunctionTypeRef, Params, Result, Flags);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:51:51: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  const auto Entry = Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.find(ID);       \
                                                  ^
<scratch space>:156:1: note: expanded from here
FunctionTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:261:29: note: in instantiation of function template specialization 'swift::reflection::FunctionTypeRef::create<swift::reflection::TypeRefBuilder>' requested here
    return FunctionTypeRef::create(*this, params, result, flags);
                            ^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:23:1: note: declared as a non-template here
TYPEREF(Function, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:128:1: note: expanded from here
FunctionTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:370:5: error: 'FunctionTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, FunctionTypeRef, Params, Result, Flags);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:56:32: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.insert({ID, TR});                  \
                               ^
<scratch space>:158:1: note: expanded from here
FunctionTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:23:1: note: declared as a non-template here
TYPEREF(Function, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:128:1: note: expanded from here
FunctionTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:417:5: error: 'ProtocolCompositionTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, ProtocolCompositionTypeRef, Protocols,
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:51:51: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  const auto Entry = Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.find(ID);       \
                                                  ^
<scratch space>:159:1: note: expanded from here
ProtocolCompositionTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:273:40: note: in instantiation of function template specialization 'swift::reflection::ProtocolCompositionTypeRef::create<swift::reflection::TypeRefBuilder>' requested here
    return ProtocolCompositionTypeRef::create(*this, protocolRefs, superclass,
                                       ^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:24:1: note: declared as a non-template here
TYPEREF(ProtocolComposition, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:130:1: note: expanded from here
ProtocolCompositionTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:417:5: error: 'ProtocolCompositionTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, ProtocolCompositionTypeRef, Protocols,
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:56:32: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.insert({ID, TR});                  \
                               ^
<scratch space>:161:1: note: expanded from here
ProtocolCompositionTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:24:1: note: declared as a non-template here
TYPEREF(ProtocolComposition, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:130:1: note: expanded from here
ProtocolCompositionTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:487:5: error: 'ExistentialMetatypeTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, ExistentialMetatypeTypeRef, InstanceType);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:51:51: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  const auto Entry = Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.find(ID);       \
                                                  ^
<scratch space>:2:1: note: expanded from here
ExistentialMetatypeTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:279:40: note: in instantiation of function template specialization 'swift::reflection::ExistentialMetatypeTypeRef::create<swift::reflection::TypeRefBuilder>' requested here
    return ExistentialMetatypeTypeRef::create(*this, instance);
                                       ^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:26:1: note: declared as a non-template here
TYPEREF(ExistentialMetatype, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:134:1: note: expanded from here
ExistentialMetatypeTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:487:5: error: 'ExistentialMetatypeTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, ExistentialMetatypeTypeRef, InstanceType);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:56:32: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.insert({ID, TR});                  \
                               ^
<scratch space>:4:1: note: expanded from here
ExistentialMetatypeTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:26:1: note: declared as a non-template here
TYPEREF(ExistentialMetatype, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:134:1: note: expanded from here
ExistentialMetatypeTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:455:5: error: 'MetatypeTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, MetatypeTypeRef, InstanceType, WasAbstract);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:51:51: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  const auto Entry = Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.find(ID);       \
                                                  ^
<scratch space>:162:1: note: expanded from here
MetatypeTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:284:29: note: in instantiation of function template specialization 'swift::reflection::MetatypeTypeRef::create<swift::reflection::TypeRefBuilder>' requested here
    return MetatypeTypeRef::create(*this, instance, WasAbstract);
                            ^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:25:1: note: declared as a non-template here
TYPEREF(Metatype, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:132:1: note: expanded from here
MetatypeTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:455:5: error: 'MetatypeTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, MetatypeTypeRef, InstanceType, WasAbstract);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:56:32: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.insert({ID, TR});                  \
                               ^
<scratch space>:164:1: note: expanded from here
MetatypeTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:25:1: note: declared as a non-template here
TYPEREF(Metatype, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:132:1: note: expanded from here
MetatypeTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:517:5: error: 'GenericTypeParameterTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, GenericTypeParameterTypeRef, Depth, Index);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:51:51: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  const auto Entry = Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.find(ID);       \
                                                  ^
<scratch space>:5:1: note: expanded from here
GenericTypeParameterTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:289:41: note: in instantiation of function template specialization 'swift::reflection::GenericTypeParameterTypeRef::create<swift::reflection::TypeRefBuilder>' requested here
    return GenericTypeParameterTypeRef::create(*this, depth, index);
                                        ^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:27:1: note: declared as a non-template here
TYPEREF(GenericTypeParameter, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:136:1: note: expanded from here
GenericTypeParameterTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:517:5: error: 'GenericTypeParameterTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, GenericTypeParameterTypeRef, Depth, Index);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:56:32: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.insert({ID, TR});                  \
                               ^
<scratch space>:7:1: note: expanded from here
GenericTypeParameterTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:27:1: note: declared as a non-template here
TYPEREF(GenericTypeParameter, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:136:1: note: expanded from here
GenericTypeParameterTypeRefs
^
In file included from /code/workspace/swift/tools/swift-reflection-dump/swift-reflection-dump.cpp:23:
In file included from /code/workspace/swift/include/swift/Reflection/ReflectionContext.h:29:
/code/workspace/swift/include/swift/Reflection/TypeRef.h:558:5: error: 'DependentMemberTypeRefs' following the 'template' keyword does not refer to a template
    FIND_OR_CREATE_TYPEREF(A, DependentMemberTypeRef, Member, Base, Protocol);
    ^
/code/workspace/swift/include/swift/Reflection/TypeRef.h:51:51: note: expanded from macro 'FIND_OR_CREATE_TYPEREF'
  const auto Entry = Allocator.DEPENDENT_TEMPLATE TypeRefTy##s.find(ID);       \
                                                  ^
<scratch space>:8:1: note: expanded from here
DependentMemberTypeRefs
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:296:36: note: in instantiation of function template specialization 'swift::reflection::DependentMemberTypeRef::create<swift::reflection::TypeRefBuilder>' requested here
    return DependentMemberTypeRef::create(*this, member, base, *protocol);
                                   ^
/code/workspace/swift/include/swift/Reflection/TypeRefs.def:28:1: note: declared as a non-template here
TYPEREF(DependentMember, TypeRef)
^
/code/workspace/swift/include/swift/Reflection/TypeRefBuilder.h:191:57: note: expanded from macro 'TYPEREF'
                     TypeRefID::Hash, TypeRefID::Equal> Id##TypeRefs;
                                                        ^
<scratch space>:138:1: note: expanded from here
DependentMemberTypeRefs
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
bc7072e8-7d37-4a38-8fee-cab463d443b7 commented 5 years ago

cc @mikeash, @bob-wilson

bob-wilson commented 5 years ago

This was fixed on master in https://github.com/apple/swift/pull/16372 and the other PRs mentioned there.

For Swift-4.2, you should build with the older version of Clang.