r219977 - Re-commit r217995 and follow-up patches (r217997, r218011, r218053). These were
Richard Smith
richard at metafoo.co.uk
Tue Nov 11 17:53:01 PST 2014
I've re-committed with a (tentative) fix in r221750.
If this still fails, please try changing the lambda-captures in some way.
I'm not sure exactly how much I need to do to avoid tripping over this GCC
bug.
On Mon, Oct 20, 2014 at 4:29 PM, Richard Smith <richard at metafoo.co.uk>
wrote:
> Ah, this is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56135
>
> GCC 4.7.2 (and no other version) incorrectly handles an implicit capture
> of 'this' within a member function template. I think this should work fine
> with an explicit capture as a workaround; I'll do that.
>
> On Mon, Oct 20, 2014 at 4:24 PM, Richard Smith <richard at metafoo.co.uk>
> wrote:
>
>> On Sun, Oct 19, 2014 at 10:43 PM, NAKAMURA Takumi <geek4civic at gmail.com>
>> wrote:
>>
>>> It might be a bug in g++-4.7.2. I will investigate what was wrong.
>>> I'm not certain when I could update g++ to 4.7.x.
>>>
>>
>> Thank you for looking. It could also be a bug in the code which only
>> manifests with certain compilers; if your investigation doesn't work out,
>> I'll install a copy of g++ 4.7.2 and see if I can reproduce it there.
>>
>>
>>> Sorry for the inconvenience.
>>>
>>
>> Thank you for the revert and the investigation!
>>
>>
>>> 2014-10-18 6:44 GMT+09:00 Richard Smith <richard at metafoo.co.uk>:
>>> > On Fri, Oct 17, 2014 at 6:08 AM, NAKAMURA Takumi <geek4civic at gmail.com
>>> >
>>> > wrote:
>>> >>
>>> >> Excuse me, reverted in r220038.
>>> >>
>>> >> With lit --vg,
>>> >
>>> >
>>> > This failure does not reproduce for me. What is your host compiler? It
>>> looks
>>> > like it might be miscompiling implicit lambda-captures of 'this'. (Or
>>> it
>>> > could be a bug in the code, but no other builder complained and the
>>> code
>>> > looks right to me...)
>>> >
>>> >>
>>> >> ******************** TEST 'Clang :: CXX/except/except.spec/p1.cpp'
>>> >> FAILED ********************
>>> >> Script:
>>> >> --
>>> >> /home/tnakamura/fio/ninja/1/./bin/clang -cc1 -internal-isystem
>>> >> /fio/tnakamura/ninja/1/bin/../lib/clang/3.6.0/include -nostdsysteminc
>>> >> -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify
>>> >>
>>> /fio/tnakamura/ninja/llvm-project/clang/test/CXX/except/except.spec/p1.cpp
>>> >> --
>>> >> Exit Code: 139
>>> >>
>>> >> Command Output (stderr):
>>> >> --
>>> >> ==9619== Invalid read of size 8
>>> >> ==9619== at 0x3897002: clang::TreeTransform<(anonymous
>>> >> namespace)::TemplateInstantiator>::getSema() const
>>> >> (TreeTransform.h:137)
>>> >>
>>> >> ==9619== by 0x389B957: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformExceptionSpec(clang::SourceLocation,
>>> >> clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> llvm::SmallVectorImpl<clang::QualType>&, bool&) (TreeTransform.h:4656)
>>> >> ==9619== by 0x3897056: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}::operator()(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&) const (TreeTransform.h:4566)
>>> >> ==9619== by 0x38B90BF: clang::QualType
>>> >> clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType<clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}>(clang::TypeLocBuilder&, clang::FunctionProtoTypeLoc,
>>> >> clang::CXXRecordDecl*, unsigned int, clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}) (TreeTransform.h:4620)
>>> >> ==9619== by 0x38A0A3B: clang::QualType (anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator::TransformFunctionProtoType<clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}>(clang::TypeLocBuilder&, clang::FunctionProtoTypeLoc,
>>> >> clang::CXXRecordDecl*, unsigned int, clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}) (SemaTemplateInstantiate.cpp:1345)
>>> >> ==9619== by 0x3897105: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >> clang::FunctionProtoTypeLoc) (TreeTransform.h:4566)
>>> >> ==9619== by 0x388F18E: (anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >> clang::FunctionProtoTypeLoc) (SemaTemplateInstantiate.cpp:796)
>>> >> ==9619== by 0x389AC8B: clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc) (TypeNodes.def:79)
>>> >> ==9619== by 0x38AEED3: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformParenType(clang::TypeLocBuilder&,
>>> >> clang::ParenTypeLoc) (TreeTransform.h:5370)
>>> >> ==9619== by 0x389ADDB: clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc) (TypeNodes.def:82)
>>> >> ==9619== by 0x38ACDE5: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformPointerType(clang::TypeLocBuilder&,
>>> >> clang::PointerTypeLoc) (TreeTransform.h:3895)
>>> >> ==9619== by 0x389A74B: clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc) (TypeNodes.def:64)
>>> >> ==9619== Address 0x0 is not stack'd, malloc'd or (recently) free'd
>>> >> ==9619==
>>> >> #0 0x223c63e llvm::sys::PrintStackTrace(_IO_FILE*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:423:0
>>> >> #1 0x223c8e5 PrintStackTraceSignalHandler(void*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:481:0
>>> >> #2 0x223b42e SignalHandler(int)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:198:0
>>> >> #3 0x8042710 __restore_rt (/lib64/libpthread.so.0+0xf710)
>>> >> #4 0x3897002 clang::TreeTransform<(anonymous
>>> >> namespace)::TemplateInstantiator>::getSema() const
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:137:0
>>> >> #5 0x389b958 clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformExceptionSpec(clang::SourceLocation,
>>> >> clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> llvm::SmallVectorImpl<clang::QualType>&, bool&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4656:0
>>> >> #6 0x3897057
>>> >>
>>> _ZZN5clang13TreeTransformIN12_GLOBAL__N_120TemplateInstantiatorEE26TransformFunctionProtoTypeERNS_14TypeLocBuilderENS_20FunctionProtoTypeLocEENKUlRNS_17FunctionProtoType17ExceptionSpecInfoERbE_clES9_SA_
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4566:0
>>> >> #7 0x38b90c0
>>> >>
>>> _ZN5clang13TreeTransformIN12_GLOBAL__N_120TemplateInstantiatorEE26TransformFunctionProtoTypeIZNS3_26TransformFunctionProtoTypeERNS_14TypeLocBuilderENS_20FunctionProtoTypeLocEEUlRNS_17FunctionProtoType17ExceptionSpecInfoERbE_EENS_8QualTypeES6_S7_PNS_13CXXRecordDeclEjT_
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4620:0
>>> >> #8 0x38a0a3c
>>> >>
>>> _ZN12_GLOBAL__N_120TemplateInstantiator26TransformFunctionProtoTypeIZN5clang13TreeTransformIS0_E26TransformFunctionProtoTypeERNS2_14TypeLocBuilderENS2_20FunctionProtoTypeLocEEUlRNS2_17FunctionProtoType17ExceptionSpecInfoERbE_EENS2_8QualTypeES6_S7_PNS2_13CXXRecordDeclEjT_
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1345:0
>>> >> #9 0x3897106 clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >> clang::FunctionProtoTypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4566:0
>>> >> #10 0x388f18f (anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >> clang::FunctionProtoTypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:797:0
>>> >> #11 0x389ac8c clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:79:0
>>> >> #12 0x38aeed4 clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformParenType(clang::TypeLocBuilder&,
>>> >> clang::ParenTypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:5370:0
>>> >> #13 0x389addc clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:82:0
>>> >> #14 0x38acde6 clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformPointerType(clang::TypeLocBuilder&,
>>> >> clang::PointerTypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:3895:0
>>> >> #15 0x389a74c clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:64:0
>>> >> #16 0x389a4c1 clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeSourceInfo*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:3667:0
>>> >> #17 0x3891b08 clang::Sema::SubstType(clang::TypeSourceInfo*,
>>> >> clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation,
>>> >> clang::DeclarationName)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1496:0
>>> >> #18 0x38cd909
>>> >> clang::TemplateDeclInstantiator::VisitVarDecl(clang::VarDecl*,
>>> >> bool)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:464:0
>>> >> #19 0x38cd7f6
>>> >> clang::TemplateDeclInstantiator::VisitVarDecl(clang::VarDecl*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:448:0
>>> >> #20 0x389d4af clang::declvisitor::Base<clang::declvisitor::make_ptr,
>>> >> clang::TemplateDeclInstantiator, clang::Decl*>::Visit(clang::Decl*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/1/tools/clang/include/clang/AST/DeclNodes.inc:391:0
>>> >> #21 0x38d6ad7 clang::Sema::SubstDecl(clang::Decl*,
>>> >> clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:2665:0
>>> >> #22 0x388f858 (anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator::TransformDefinition(clang::SourceLocation,
>>> >> clang::Decl*)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:930:0
>>> >> #23 0x38b417e clang::TreeTransform<(anonymous
>>> >> namespace)::TemplateInstantiator>::TransformDeclStmt(clang::DeclStmt*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:6020:0
>>> >> #24 0x389dc8a clang::TreeTransform<(anonymous
>>> >> namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/1/tools/clang/include/clang/AST/StmtNodes.inc:91:0
>>> >> #25 0x38bc776 clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*,
>>> >> bool)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:5583:0
>>> >> #26 0x38b408a clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:5571:0
>>> >> #27 0x389dc34 clang::TreeTransform<(anonymous
>>> >> namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/1/tools/clang/include/clang/AST/StmtNodes.inc:79:0
>>> >> #28 0x3895a8b clang::Sema::SubstStmt(clang::Stmt*,
>>> >> clang::MultiLevelTemplateArgumentList const&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:2627:0
>>> >> #29 0x38d93e1
>>> >> clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
>>> >> clang::FunctionDecl*, bool, bool)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:3422:0
>>> >> #30 0x38dd047 clang::Sema::PerformPendingInstantiations(bool)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4591:0
>>> >> #31 0x33ee329 clang::Sema::ActOnEndOfTranslationUnit()
>>> >> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/Sema.cpp:675:0
>>> >> #32 0x31f4e39
>>> >>
>>> clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/Parser.cpp:549:0
>>> >> #33 0x31ee338 clang::ParseAST(clang::Sema&, bool, bool)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseAST.cpp:139:0
>>> >> #34 0x2431f37 clang::ASTFrontendAction::ExecuteAction()
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/FrontendAction.cpp:522:0
>>> >> #35 0x2431a00 clang::FrontendAction::Execute()
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/FrontendAction.cpp:427:0
>>> >> #36 0x23f9744
>>> >> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:812:0
>>> >> #37 0x2546564
>>> clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:222:0
>>> >> #38 0x10ade45 cc1_main(llvm::ArrayRef<char const*>, char const*,
>>> >> void*)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/tools/driver/cc1_main.cpp:110:0
>>> >> #39 0x10a6bd4 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
>>> >> llvm::StringRef)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/tools/driver/driver.cpp:364:0
>>> >> #40 0x10a7224 main
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/tools/driver/driver.cpp:410:0
>>> >> #41 0x8a0ed5d __libc_start_main (/lib64/libc.so.6+0x1ed5d)
>>> >> #42 0x10a39f9 _start (/fio/tnakamura/ninja/1/bin/clang-3.5+0x10a39f9)
>>> >> Stack dump:
>>> >> 0. Program arguments: /home/tnakamura/fio/ninja/1/./bin/clang
>>> >> -cc1 -internal-isystem
>>> >> /fio/tnakamura/ninja/1/bin/../lib/clang/3.6.0/include -nostdsysteminc
>>> >> -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify
>>> >>
>>> /fio/tnakamura/ninja/llvm-project/clang/test/CXX/except/except.spec/p1.cpp
>>> >> 1. <eof> parser at end of file
>>> >> 2. ==9619==
>>> >> ==9619== Process terminating with default action of signal 11
>>> (SIGSEGV)
>>> >> ==9619== General Protection Fault
>>> >> ==9619== at 0x233CAAF:
>>> >> ComputeLineNumbers(clang::DiagnosticsEngine&,
>>> >> clang::SrcMgr::ContentCache*,
>>> >> llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&,
>>> >> clang::SourceManager const&, bool&) (emmintrin.h:606)
>>> >> ==9619== by 0x233D0E0:
>>> >> clang::SourceManager::getLineNumber(clang::FileID, unsigned int,
>>> >> bool*) const (SourceManager.cpp:1307)
>>> >> ==9619== by 0x233D6E7:
>>> >> clang::SourceManager::getPresumedLoc(clang::SourceLocation, bool)
>>> >> const (SourceManager.cpp:1470)
>>> >> ==9619== by 0x233657C:
>>> >> clang::SourceLocation::print(llvm::raw_ostream&, clang::SourceManager
>>> >> const&) const (SourceLocation.cpp:45)
>>> >> ==9619== by 0x33F0788:
>>> >> clang::PrettyDeclStackTraceEntry::print(llvm::raw_ostream&) const
>>> >> (Sema.cpp:1235)
>>> >> ==9619== by 0x2202BE2: PrintStack(llvm::PrettyStackTraceEntry
>>> >> const*, llvm::raw_ostream&) (PrettyStackTrace.cpp:40)
>>> >> ==9619== by 0x2202C56: PrintCurStackTrace(llvm::raw_ostream&)
>>> >> (PrettyStackTrace.cpp:54)
>>> >> ==9619== by 0x2202C80: CrashHandler(void*)
>>> (PrettyStackTrace.cpp:79)
>>> >> ==9619== by 0x223B42D: SignalHandler(int) (Signals.inc:199)
>>> >> ==9619== by 0x804270F: ??? (in /lib64/libpthread-2.12.so)
>>> >> ==9619== by 0x3897001: clang::TreeTransform<(anonymous
>>> >> namespace)::TemplateInstantiator>::getSema() const
>>> >> (TreeTransform.h:137)
>>> >> ==9619== by 0x389B957: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformExceptionSpec(clang::SourceLocation,
>>> >> clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> llvm::SmallVectorImpl<clang::QualType>&, bool&) (TreeTransform.h:4656)
>>> >>
>>> >>
>>> /fio/tnakamura/ninja/1/tools/clang/test/CXX/except/except.spec/Output/p1.cpp.script:
>>> >> line 1: 9619 Segmentation fault
>>> >> /home/tnakamura/fio/ninja/1/./bin/clang -cc1 -internal-isystem
>>> >> /fio/tnakamura/ninja/1/bin/../lib/clang/3.6.0/include -nostdsysteminc
>>> >> -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify
>>> >>
>>> /fio/tnakamura/ninja/llvm-project/clang/test/CXX/except/except.spec/p1.cpp
>>> >>
>>> >> --
>>> >>
>>> >> ********************
>>> >> FAIL: Clang :: SemaTemplate/instantiate-exception-spec.cpp (208 of
>>> 209)
>>> >> ******************** TEST 'Clang ::
>>> >> SemaTemplate/instantiate-exception-spec.cpp' FAILED
>>> >> ********************
>>> >> Script:
>>> >> --
>>> >> /home/tnakamura/fio/ninja/1/./bin/clang -cc1 -internal-isystem
>>> >> /fio/tnakamura/ninja/1/bin/../lib/clang/3.6.0/include -nostdsysteminc
>>> >> -fexceptions -fcxx-exceptions -verify
>>> >>
>>> >>
>>> /fio/tnakamura/ninja/llvm-project/clang/test/SemaTemplate/instantiate-exception-spec.cpp
>>> >> -DERRORS
>>> >> /home/tnakamura/fio/ninja/1/./bin/clang -cc1 -internal-isystem
>>> >> /fio/tnakamura/ninja/1/bin/../lib/clang/3.6.0/include -nostdsysteminc
>>> >> -fexceptions -fcxx-exceptions -emit-llvm-only
>>> >>
>>> >>
>>> /fio/tnakamura/ninja/llvm-project/clang/test/SemaTemplate/instantiate-exception-spec.cpp
>>> >> --
>>> >> Exit Code: 139
>>> >>
>>> >> Command Output (stderr):
>>> >> --
>>> >> ==9810== Invalid read of size 4
>>> >> ==9810== at 0x388EE1E: (anonymous
>>> >> namespace)::TemplateInstantiator::getBaseLocation()
>>> >> (SemaTemplateInstantiate.cpp:664)
>>> >> ==9810== by 0x3899DF5: clang::TreeTransform<(anonymous
>>> >> namespace)::TemplateInstantiator>::TransformType(clang::QualType)
>>> >> (TreeTransform.h:3644)
>>> >> ==9810== by 0x389BFAC: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformExceptionSpec(clang::SourceLocation,
>>> >> clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> llvm::SmallVectorImpl<clang::QualType>&, bool&) (TreeTransform.h:4734)
>>> >> ==9810== by 0x3897056: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}::operator()(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&) const (TreeTransform.h:4566)
>>> >> ==9810== by 0x38B90BF: clang::QualType
>>> >> clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType<clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}>(clang::TypeLocBuilder&, clang::FunctionProtoTypeLoc,
>>> >> clang::CXXRecordDecl*, unsigned int, clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}) (TreeTransform.h:4620)
>>> >> ==9810== by 0x38A0A3B: clang::QualType (anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator::TransformFunctionProtoType<clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}>(clang::TypeLocBuilder&, clang::FunctionProtoTypeLoc,
>>> >> clang::CXXRecordDecl*, unsigned int, clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}) (SemaTemplateInstantiate.cpp:1345)
>>> >> ==9810== by 0x3897105: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >> clang::FunctionProtoTypeLoc) (TreeTransform.h:4566)
>>> >> ==9810== by 0x388F18E: (anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >> clang::FunctionProtoTypeLoc) (SemaTemplateInstantiate.cpp:796)
>>> >> ==9810== by 0x389AC8B: clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc) (TypeNodes.def:79)
>>> >> ==9810== by 0x38AEED3: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformParenType(clang::TypeLocBuilder&,
>>> >> clang::ParenTypeLoc) (TreeTransform.h:5370)
>>> >> ==9810== by 0x389ADDB: clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc) (TypeNodes.def:82)
>>> >> ==9810== by 0x38ACDE5: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformPointerType(clang::TypeLocBuilder&,
>>> >> clang::PointerTypeLoc) (TreeTransform.h:3895)
>>> >> ==9810== Address 0x28 is not stack'd, malloc'd or (recently) free'd
>>> >> ==9810==
>>> >> #0 0x223c63e llvm::sys::PrintStackTrace(_IO_FILE*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:423:0
>>> >> #1 0x223c8e5 PrintStackTraceSignalHandler(void*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:481:0
>>> >> #2 0x223b42e SignalHandler(int)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:198:0
>>> >> #3 0x8042710 __restore_rt (/lib64/libpthread.so.0+0xf710)
>>> >> #4 0x388ee1e (anonymous
>>> >> namespace)::TemplateInstantiator::getBaseLocation()
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:664:0
>>> >> #5 0x3899df6 clang::TreeTransform<(anonymous
>>> >> namespace)::TemplateInstantiator>::TransformType(clang::QualType)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:3644:0
>>> >> #6 0x389bfad clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformExceptionSpec(clang::SourceLocation,
>>> >> clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> llvm::SmallVectorImpl<clang::QualType>&, bool&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4734:0
>>> >> #7 0x3897057
>>> >>
>>> _ZZN5clang13TreeTransformIN12_GLOBAL__N_120TemplateInstantiatorEE26TransformFunctionProtoTypeERNS_14TypeLocBuilderENS_20FunctionProtoTypeLocEENKUlRNS_17FunctionProtoType17ExceptionSpecInfoERbE_clES9_SA_
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4566:0
>>> >> #8 0x38b90c0
>>> >>
>>> _ZN5clang13TreeTransformIN12_GLOBAL__N_120TemplateInstantiatorEE26TransformFunctionProtoTypeIZNS3_26TransformFunctionProtoTypeERNS_14TypeLocBuilderENS_20FunctionProtoTypeLocEEUlRNS_17FunctionProtoType17ExceptionSpecInfoERbE_EENS_8QualTypeES6_S7_PNS_13CXXRecordDeclEjT_
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4620:0
>>> >> #9 0x38a0a3c
>>> >>
>>> _ZN12_GLOBAL__N_120TemplateInstantiator26TransformFunctionProtoTypeIZN5clang13TreeTransformIS0_E26TransformFunctionProtoTypeERNS2_14TypeLocBuilderENS2_20FunctionProtoTypeLocEEUlRNS2_17FunctionProtoType17ExceptionSpecInfoERbE_EENS2_8QualTypeES6_S7_PNS2_13CXXRecordDeclEjT_
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1345:0
>>> >> #10 0x3897106 clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >> clang::FunctionProtoTypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4566:0
>>> >> #11 0x388f18f (anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >> clang::FunctionProtoTypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:797:0
>>> >> #12 0x389ac8c clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:79:0
>>> >> #13 0x38aeed4 clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformParenType(clang::TypeLocBuilder&,
>>> >> clang::ParenTypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:5370:0
>>> >> #14 0x389addc clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:82:0
>>> >> #15 0x38acde6 clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformPointerType(clang::TypeLocBuilder&,
>>> >> clang::PointerTypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:3895:0
>>> >> #16 0x389a74c clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:64:0
>>> >> #17 0x389a4c1 clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeSourceInfo*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:3667:0
>>> >> #18 0x3891b08 clang::Sema::SubstType(clang::TypeSourceInfo*,
>>> >> clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation,
>>> >> clang::DeclarationName)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1496:0
>>> >> #19 0x389280d clang::Sema::SubstParmVarDecl(clang::ParmVarDecl*,
>>> >> clang::MultiLevelTemplateArgumentList const&, int,
>>> >> llvm::Optional<unsigned int>, bool)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1680:0
>>> >> #20 0x38912db (anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator::TransformFunctionTypeParam(clang::ParmVarDecl*,
>>> >> int, llvm::Optional<unsigned int>, bool)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1354:0
>>> >> #21 0x389c89b clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionTypeParams(clang::SourceLocation,
>>> >> clang::ParmVarDecl**, unsigned int, clang::QualType const*,
>>> >> llvm::SmallVectorImpl<clang::QualType>&,
>>> >> llvm::SmallVectorImpl<clang::ParmVarDecl*>*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4455:0
>>> >> #22 0x3892be4 clang::Sema::SubstParmTypes(clang::SourceLocation,
>>> >> clang::ParmVarDecl**, unsigned int,
>>> >> clang::MultiLevelTemplateArgumentList const&,
>>> >> llvm::SmallVectorImpl<clang::QualType>&,
>>> >> llvm::SmallVectorImpl<clang::ParmVarDecl*>*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1751:0
>>> >> #23 0x385483a
>>> >>
>>> clang::Sema::SubstituteExplicitTemplateArguments(clang::FunctionTemplateDecl*,
>>> >> clang::TemplateArgumentListInfo&,
>>> >> llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&,
>>> >> llvm::SmallVectorImpl<clang::QualType>&, clang::QualType*,
>>> >> clang::sema::TemplateDeductionInfo&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:2632:0
>>> >> #24 0x3856c44
>>> >> clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
>>> >> clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>,
>>> >> clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:3337:0
>>> >> #25 0x374461b
>>> >>
>>> clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*,
>>> >> clang::DeclAccessPair, clang::TemplateArgumentListInfo*,
>>> >> llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaOverload.cpp:6108:0
>>> >> #26 0x3753f5a clang::AddOverloadedCallCandidate(clang::Sema&,
>>> >> clang::DeclAccessPair, clang::TemplateArgumentListInfo*,
>>> >> llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool,
>>> >> bool)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaOverload.cpp:10353:0
>>> >> #27 0x37541d6
>>> >> clang::Sema::AddOverloadedCallCandidates(clang::UnresolvedLookupExpr*,
>>> >> llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaOverload.cpp:10405:0
>>> >> #28 0x375535a clang::Sema::buildOverloadedCallSet(clang::Scope*,
>>> >> clang::Expr*, clang::UnresolvedLookupExpr*,
>>> >> llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
>>> >> clang::OverloadCandidateSet*, clang::ActionResult<clang::Expr*,
>>> >> true>*)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaOverload.cpp:10677:0
>>> >> #29 0x3755b9d clang::Sema::BuildOverloadedCallExpr(clang::Scope*,
>>> >> clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation,
>>> >> llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
>>> >> clang::Expr*, bool)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaOverload.cpp:10788:0
>>> >> #30 0x35d6d05 clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*,
>>> >> clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
>>> >> clang::SourceLocation, clang::Expr*, bool)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaExpr.cpp:4549:0
>>> >> #31 0x3230e37
>>> >>
>>> clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
>>> >> true>)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseExpr.cpp:1426:0
>>> >> #32 0x323032f clang::Parser::ParseCastExpression(bool, bool, bool&,
>>> >> clang::Parser::TypeCastState)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseExpr.cpp:1251:0
>>> >> #33 0x322cc9c clang::Parser::ParseCastExpression(bool, bool,
>>> >> clang::Parser::TypeCastState)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseExpr.cpp:417:0
>>> >> #34 0x322bd81
>>> >> clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseExpr.cpp:169:0
>>> >> #35 0x322bba8
>>> clang::Parser::ParseExpression(clang::Parser::TypeCastState)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseExpr.cpp:121:0
>>> >> #36 0x3261c17 clang::Parser::ParseExprStatement()
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseStmt.cpp:384:0
>>> >> #37 0x32614c8
>>> >>
>>> clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
>>> >> 32u>&, bool, clang::SourceLocation*,
>>> >> clang::Parser::ParsedAttributesWithRange&)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseStmt.cpp:220:0
>>> >> #38 0x3260d60
>>> >>
>>> clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
>>> >> 32u>&, bool, clang::SourceLocation*)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseStmt.cpp:107:0
>>> >> #39 0x3263b65 clang::Parser::ParseCompoundStatementBody(bool)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseStmt.cpp:938:0
>>> >> #40 0x3266e9e clang::Parser::ParseFunctionStatementBody(clang::Decl*,
>>> >> clang::Parser::ParseScope&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseStmt.cpp:1857:0
>>> >> #41 0x31f6f78
>>> >> clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
>>> >> clang::Parser::ParsedTemplateInfo const&,
>>> >> clang::Parser::LateParsedAttrList*)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/Parser.cpp:1098:0
>>> >> #42 0x3207290 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
>>> >> unsigned int, bool, clang::SourceLocation*,
>>> >> clang::Parser::ForRangeInit*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseDecl.cpp:1599:0
>>> >> #43 0x31f61c8
>>> >>
>>> clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
>>> >> clang::ParsingDeclSpec&, clang::AccessSpecifier)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/Parser.cpp:889:0
>>> >> #44 0x31f62ac
>>> >>
>>> clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
>>> >> clang::ParsingDeclSpec*, clang::AccessSpecifier)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/Parser.cpp:904:0
>>> >> #45 0x31f59e1
>>> >>
>>> clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
>>> >> clang::ParsingDeclSpec*)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/Parser.cpp:762:0
>>> >> #46 0x31f4ea8
>>> >>
>>> clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/Parser.cpp:559:0
>>> >> #47 0x31ee338 clang::ParseAST(clang::Sema&, bool, bool)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseAST.cpp:139:0
>>> >> #48 0x2431f37 clang::ASTFrontendAction::ExecuteAction()
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/FrontendAction.cpp:522:0
>>> >> #49 0x2431a00 clang::FrontendAction::Execute()
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/FrontendAction.cpp:427:0
>>> >> #50 0x23f9744
>>> >> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:812:0
>>> >> #51 0x2546564
>>> clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:222:0
>>> >> #52 0x10ade45 cc1_main(llvm::ArrayRef<char const*>, char const*,
>>> >> void*)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/tools/driver/cc1_main.cpp:110:0
>>> >> #53 0x10a6bd4 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
>>> >> llvm::StringRef)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/tools/driver/driver.cpp:364:0
>>> >> #54 0x10a7224 main
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/tools/driver/driver.cpp:410:0
>>> >> #55 0x8a0ed5d __libc_start_main (/lib64/libc.so.6+0x1ed5d)
>>> >> #56 0x10a39f9 _start (/fio/tnakamura/ninja/1/bin/clang-3.5+0x10a39f9)
>>> >> Stack dump:
>>> >> 0. Program arguments: /home/tnakamura/fio/ninja/1/./bin/clang
>>> >> -cc1 -internal-isystem
>>> >> /fio/tnakamura/ninja/1/bin/../lib/clang/3.6.0/include -nostdsysteminc
>>> >> -fexceptions -fcxx-exceptions -verify
>>> >>
>>> >>
>>> /fio/tnakamura/ninja/llvm-project/clang/test/SemaTemplate/instantiate-exception-spec.cpp
>>> >> -DERRORS
>>> >> 1. ==9810==
>>> >> ==9810== Process terminating with default action of signal 11
>>> (SIGSEGV)
>>> >> ==9810== General Protection Fault
>>> >> ==9810== at 0x233CAAF:
>>> >> ComputeLineNumbers(clang::DiagnosticsEngine&,
>>> >> clang::SrcMgr::ContentCache*,
>>> >> llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&,
>>> >> clang::SourceManager const&, bool&) (emmintrin.h:606)
>>> >> ==9810== by 0x233D0E0:
>>> >> clang::SourceManager::getLineNumber(clang::FileID, unsigned int,
>>> >> bool*) const (SourceManager.cpp:1307)
>>> >> ==9810== by 0x233D6E7:
>>> >> clang::SourceManager::getPresumedLoc(clang::SourceLocation, bool)
>>> >> const (SourceManager.cpp:1470)
>>> >> ==9810== by 0x233657C:
>>> >> clang::SourceLocation::print(llvm::raw_ostream&, clang::SourceManager
>>> >> const&) const (SourceLocation.cpp:45)
>>> >> ==9810== by 0x31EDF16: (anonymous
>>> >> namespace)::PrettyStackTraceParserEntry::print(llvm::raw_ostream&)
>>> >> const (ParseAST.cpp:57)
>>> >> ==9810== by 0x2202BE2: PrintStack(llvm::PrettyStackTraceEntry
>>> >> const*, llvm::raw_ostream&) (PrettyStackTrace.cpp:40)
>>> >> ==9810== by 0x2202B90: PrintStack(llvm::PrettyStackTraceEntry
>>> >> const*, llvm::raw_ostream&) (PrettyStackTrace.cpp:36)
>>> >> ==9810== by 0x2202B90: PrintStack(llvm::PrettyStackTraceEntry
>>> >> const*, llvm::raw_ostream&) (PrettyStackTrace.cpp:36)
>>> >> ==9810== by 0x2202C56: PrintCurStackTrace(llvm::raw_ostream&)
>>> >> (PrettyStackTrace.cpp:54)
>>> >> ==9810== by 0x2202C80: CrashHandler(void*)
>>> (PrettyStackTrace.cpp:79)
>>> >> ==9810== by 0x223B42D: SignalHandler(int) (Signals.inc:199)
>>> >> ==9810== by 0x804270F: ??? (in /lib64/libpthread-2.12.so)
>>> >>
>>> >>
>>> /fio/tnakamura/ninja/1/tools/clang/test/SemaTemplate/Output/instantiate-exception-spec.cpp.script:
>>> >> line 2: 9810 Segmentation fault
>>> >> /home/tnakamura/fio/ninja/1/./bin/clang -cc1 -internal-isystem
>>> >> /fio/tnakamura/ninja/1/bin/../lib/clang/3.6.0/include -nostdsysteminc
>>> >> -fexceptions -fcxx-exceptions -verify
>>> >>
>>> >>
>>> /fio/tnakamura/ninja/llvm-project/clang/test/SemaTemplate/instantiate-exception-spec.cpp
>>> >> -DERRORS
>>> >>
>>> >> --
>>> >>
>>> >> ********************
>>> >> FAIL: Clang :: SemaTemplate/instantiate-exception-spec-cxx11.cpp (209
>>> of
>>> >> 209)
>>> >> ******************** TEST 'Clang ::
>>> >> SemaTemplate/instantiate-exception-spec-cxx11.cpp' FAILED
>>> >> ********************
>>> >> Script:
>>> >> --
>>> >> /home/tnakamura/fio/ninja/1/./bin/clang -cc1 -internal-isystem
>>> >> /fio/tnakamura/ninja/1/bin/../lib/clang/3.6.0/include -nostdsysteminc
>>> >> -fsyntax-only -verify -triple x86_64-unknown-linux-gnu -std=c++11
>>> >> -ftemplate-depth 16 -fcxx-exceptions -fexceptions
>>> >>
>>> >>
>>> /fio/tnakamura/ninja/llvm-project/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
>>> >> --
>>> >> Exit Code: 139
>>> >>
>>> >> Command Output (stderr):
>>> >> --
>>> >> ==9809== Invalid read of size 4
>>> >> ==9809== at 0x388EE1E: (anonymous
>>> >> namespace)::TemplateInstantiator::getBaseLocation()
>>> >> (SemaTemplateInstantiate.cpp:664)
>>> >> ==9809== by 0x3899DF5: clang::TreeTransform<(anonymous
>>> >> namespace)::TemplateInstantiator>::TransformType(clang::QualType)
>>> >> (TreeTransform.h:3644)
>>> >> ==9809== by 0x389BFAC: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformExceptionSpec(clang::SourceLocation,
>>> >> clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> llvm::SmallVectorImpl<clang::QualType>&, bool&) (TreeTransform.h:4734)
>>> >> ==9809== by 0x3897056: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}::operator()(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&) const (TreeTransform.h:4566)
>>> >> ==9809== by 0x38B90BF: clang::QualType
>>> >> clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType<clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}>(clang::TypeLocBuilder&, clang::FunctionProtoTypeLoc,
>>> >> clang::CXXRecordDecl*, unsigned int, clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}) (TreeTransform.h:4620)
>>> >> ==9809== by 0x38A0A3B: clang::QualType (anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator::TransformFunctionProtoType<clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}>(clang::TypeLocBuilder&, clang::FunctionProtoTypeLoc,
>>> >> clang::CXXRecordDecl*, unsigned int, clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >>
>>> >>
>>> clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> bool&)#1}) (SemaTemplateInstantiate.cpp:1345)
>>> >> ==9809== by 0x3897105: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >> clang::FunctionProtoTypeLoc) (TreeTransform.h:4566)
>>> >> ==9809== by 0x388F18E: (anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >> clang::FunctionProtoTypeLoc) (SemaTemplateInstantiate.cpp:796)
>>> >> ==9809== by 0x389AC8B: clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc) (TypeNodes.def:79)
>>> >> ==9809== by 0x38AEED3: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformParenType(clang::TypeLocBuilder&,
>>> >> clang::ParenTypeLoc) (TreeTransform.h:5370)
>>> >> ==9809== by 0x389ADDB: clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc) (TypeNodes.def:82)
>>> >> ==9809== by 0x38ACDE5: clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformPointerType(clang::TypeLocBuilder&,
>>> >> clang::PointerTypeLoc) (TreeTransform.h:3895)
>>> >> ==9809== Address 0x28 is not stack'd, malloc'd or (recently) free'd
>>> >> ==9809==
>>> >> #0 0x223c63e llvm::sys::PrintStackTrace(_IO_FILE*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:423:0
>>> >> #1 0x223c8e5 PrintStackTraceSignalHandler(void*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:481:0
>>> >> #2 0x223b42e SignalHandler(int)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:198:0
>>> >> #3 0x8042710 __restore_rt (/lib64/libpthread.so.0+0xf710)
>>> >> #4 0x388ee1e (anonymous
>>> >> namespace)::TemplateInstantiator::getBaseLocation()
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:664:0
>>> >> #5 0x3899df6 clang::TreeTransform<(anonymous
>>> >> namespace)::TemplateInstantiator>::TransformType(clang::QualType)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:3644:0
>>> >> #6 0x389bfad clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformExceptionSpec(clang::SourceLocation,
>>> >> clang::FunctionProtoType::ExceptionSpecInfo&,
>>> >> llvm::SmallVectorImpl<clang::QualType>&, bool&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4734:0
>>> >> #7 0x3897057
>>> >>
>>> _ZZN5clang13TreeTransformIN12_GLOBAL__N_120TemplateInstantiatorEE26TransformFunctionProtoTypeERNS_14TypeLocBuilderENS_20FunctionProtoTypeLocEENKUlRNS_17FunctionProtoType17ExceptionSpecInfoERbE_clES9_SA_
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4566:0
>>> >> #8 0x38b90c0
>>> >>
>>> _ZN5clang13TreeTransformIN12_GLOBAL__N_120TemplateInstantiatorEE26TransformFunctionProtoTypeIZNS3_26TransformFunctionProtoTypeERNS_14TypeLocBuilderENS_20FunctionProtoTypeLocEEUlRNS_17FunctionProtoType17ExceptionSpecInfoERbE_EENS_8QualTypeES6_S7_PNS_13CXXRecordDeclEjT_
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4620:0
>>> >> #9 0x38a0a3c
>>> >>
>>> _ZN12_GLOBAL__N_120TemplateInstantiator26TransformFunctionProtoTypeIZN5clang13TreeTransformIS0_E26TransformFunctionProtoTypeERNS2_14TypeLocBuilderENS2_20FunctionProtoTypeLocEEUlRNS2_17FunctionProtoType17ExceptionSpecInfoERbE_EENS2_8QualTypeES6_S7_PNS2_13CXXRecordDeclEjT_
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1345:0
>>> >> #10 0x3897106 clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >> clang::FunctionProtoTypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4566:0
>>> >> #11 0x388f18f (anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator::TransformFunctionProtoType(clang::TypeLocBuilder&,
>>> >> clang::FunctionProtoTypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:797:0
>>> >> #12 0x389ac8c clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:79:0
>>> >> #13 0x38aeed4 clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformParenType(clang::TypeLocBuilder&,
>>> >> clang::ParenTypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:5370:0
>>> >> #14 0x389addc clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:82:0
>>> >> #15 0x38acde6 clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformPointerType(clang::TypeLocBuilder&,
>>> >> clang::PointerTypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:3895:0
>>> >> #16 0x389a74c clang::TreeTransform<(anonymous
>>> >>
>>> namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
>>> >> clang::TypeLoc)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:64:0
>>> >> #17 0x3891d3f clang::Sema::SubstType(clang::TypeLoc,
>>> >> clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation,
>>> >> clang::DeclarationName)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1522:0
>>> >> #18 0x38926b0 clang::Sema::SubstParmVarDecl(clang::ParmVarDecl*,
>>> >> clang::MultiLevelTemplateArgumentList const&, int,
>>> >> llvm::Optional<unsigned int>, bool)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1658:0
>>> >> #19 0x38912db (anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator::TransformFunctionTypeParam(clang::ParmVarDecl*,
>>> >> int, llvm::Optional<unsigned int>, bool)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1354:0
>>> >> #20 0x389c568 clang::TreeTransform<(anonymous
>>> >>
>>> >>
>>> namespace)::TemplateInstantiator>::TransformFunctionTypeParams(clang::SourceLocation,
>>> >> clang::ParmVarDecl**, unsigned int, clang::QualType const*,
>>> >> llvm::SmallVectorImpl<clang::QualType>&,
>>> >> llvm::SmallVectorImpl<clang::ParmVarDecl*>*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4411:0
>>> >> #21 0x3892be4 clang::Sema::SubstParmTypes(clang::SourceLocation,
>>> >> clang::ParmVarDecl**, unsigned int,
>>> >> clang::MultiLevelTemplateArgumentList const&,
>>> >> llvm::SmallVectorImpl<clang::QualType>&,
>>> >> llvm::SmallVectorImpl<clang::ParmVarDecl*>*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1751:0
>>> >> #22 0x385483a
>>> >>
>>> clang::Sema::SubstituteExplicitTemplateArguments(clang::FunctionTemplateDecl*,
>>> >> clang::TemplateArgumentListInfo&,
>>> >> llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&,
>>> >> llvm::SmallVectorImpl<clang::QualType>&, clang::QualType*,
>>> >> clang::sema::TemplateDeductionInfo&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:2632:0
>>> >> #23 0x3856c44
>>> >> clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
>>> >> clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>,
>>> >> clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:3337:0
>>> >> #24 0x374461b
>>> >>
>>> clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*,
>>> >> clang::DeclAccessPair, clang::TemplateArgumentListInfo*,
>>> >> llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaOverload.cpp:6108:0
>>> >> #25 0x3753f5a clang::AddOverloadedCallCandidate(clang::Sema&,
>>> >> clang::DeclAccessPair, clang::TemplateArgumentListInfo*,
>>> >> llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool,
>>> >> bool)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaOverload.cpp:10353:0
>>> >> #26 0x37541d6
>>> >> clang::Sema::AddOverloadedCallCandidates(clang::UnresolvedLookupExpr*,
>>> >> llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaOverload.cpp:10405:0
>>> >> #27 0x375535a clang::Sema::buildOverloadedCallSet(clang::Scope*,
>>> >> clang::Expr*, clang::UnresolvedLookupExpr*,
>>> >> llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
>>> >> clang::OverloadCandidateSet*, clang::ActionResult<clang::Expr*,
>>> >> true>*)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaOverload.cpp:10677:0
>>> >> #28 0x3755b9d clang::Sema::BuildOverloadedCallExpr(clang::Scope*,
>>> >> clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation,
>>> >> llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
>>> >> clang::Expr*, bool)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaOverload.cpp:10788:0
>>> >> #29 0x35d6d05 clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*,
>>> >> clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
>>> >> clang::SourceLocation, clang::Expr*, bool)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaExpr.cpp:4549:0
>>> >> #30 0x3230e37
>>> >>
>>> clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
>>> >> true>)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseExpr.cpp:1426:0
>>> >> #31 0x323032f clang::Parser::ParseCastExpression(bool, bool, bool&,
>>> >> clang::Parser::TypeCastState)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseExpr.cpp:1251:0
>>> >> #32 0x322cc9c clang::Parser::ParseCastExpression(bool, bool,
>>> >> clang::Parser::TypeCastState)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseExpr.cpp:417:0
>>> >> #33 0x322bd81
>>> >> clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseExpr.cpp:169:0
>>> >> #34 0x322bba8
>>> clang::Parser::ParseExpression(clang::Parser::TypeCastState)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseExpr.cpp:121:0
>>> >> #35 0x3261c17 clang::Parser::ParseExprStatement()
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseStmt.cpp:384:0
>>> >> #36 0x32614c8
>>> >>
>>> clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
>>> >> 32u>&, bool, clang::SourceLocation*,
>>> >> clang::Parser::ParsedAttributesWithRange&)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseStmt.cpp:220:0
>>> >> #37 0x3260d60
>>> >>
>>> clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
>>> >> 32u>&, bool, clang::SourceLocation*)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseStmt.cpp:107:0
>>> >> #38 0x3263b65 clang::Parser::ParseCompoundStatementBody(bool)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseStmt.cpp:938:0
>>> >> #39 0x3266e9e clang::Parser::ParseFunctionStatementBody(clang::Decl*,
>>> >> clang::Parser::ParseScope&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseStmt.cpp:1857:0
>>> >> #40 0x31f6f78
>>> >> clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
>>> >> clang::Parser::ParsedTemplateInfo const&,
>>> >> clang::Parser::LateParsedAttrList*)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/Parser.cpp:1098:0
>>> >> #41 0x3207290 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
>>> >> unsigned int, bool, clang::SourceLocation*,
>>> >> clang::Parser::ForRangeInit*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseDecl.cpp:1599:0
>>> >> #42 0x31f61c8
>>> >>
>>> clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
>>> >> clang::ParsingDeclSpec&, clang::AccessSpecifier)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/Parser.cpp:889:0
>>> >> #43 0x31f62ac
>>> >>
>>> clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
>>> >> clang::ParsingDeclSpec*, clang::AccessSpecifier)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/Parser.cpp:904:0
>>> >> #44 0x31f59e1
>>> >>
>>> clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
>>> >> clang::ParsingDeclSpec*)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/Parser.cpp:762:0
>>> >> #45 0x321b083
>>> >> clang::Parser::ParseInnerNamespace(std::vector<clang::SourceLocation,
>>> >> std::allocator<clang::SourceLocation> >&,
>>> >> std::vector<clang::IdentifierInfo*,
>>> >> std::allocator<clang::IdentifierInfo*> >&,
>>> >> std::vector<clang::SourceLocation,
>>> >> std::allocator<clang::SourceLocation> >&, unsigned int,
>>> >> clang::SourceLocation&, clang::ParsedAttributes&,
>>> >> clang::BalancedDelimiterTracker&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:210:0
>>> >> #46 0x321aeeb clang::Parser::ParseNamespace(unsigned int,
>>> >> clang::SourceLocation&, clang::SourceLocation)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:189:0
>>> >> #47 0x320677a
>>> >> clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*,
>>> >> 32u>&, unsigned int, clang::SourceLocation&,
>>> >> clang::Parser::ParsedAttributesWithRange&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseDecl.cpp:1340:0
>>> >> #48 0x31f55db
>>> >>
>>> clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
>>> >> clang::ParsingDeclSpec*)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/Parser.cpp:701:0
>>> >> #49 0x31f4ea8
>>> >>
>>> clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/Parser.cpp:559:0
>>> >> #50 0x31ee338 clang::ParseAST(clang::Sema&, bool, bool)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseAST.cpp:139:0
>>> >> #51 0x2431f37 clang::ASTFrontendAction::ExecuteAction()
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/FrontendAction.cpp:522:0
>>> >> #52 0x2431a00 clang::FrontendAction::Execute()
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/FrontendAction.cpp:427:0
>>> >> #53 0x23f9744
>>> >> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:812:0
>>> >> #54 0x2546564
>>> clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
>>> >>
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:222:0
>>> >> #55 0x10ade45 cc1_main(llvm::ArrayRef<char const*>, char const*,
>>> >> void*)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/tools/driver/cc1_main.cpp:110:0
>>> >> #56 0x10a6bd4 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
>>> >> llvm::StringRef)
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/tools/driver/driver.cpp:364:0
>>> >> #57 0x10a7224 main
>>> >>
>>> /home/tnakamura/fio/ninja/llvm-project/clang/tools/driver/driver.cpp:410:0
>>> >> #58 0x8a0ed5d __libc_start_main (/lib64/libc.so.6+0x1ed5d)
>>> >> #59 0x10a39f9 _start (/fio/tnakamura/ninja/1/bin/clang-3.5+0x10a39f9)
>>> >> Stack dump:
>>> >> 0. Program arguments: /home/tnakamura/fio/ninja/1/./bin/clang
>>> >> -cc1 -internal-isystem
>>> >> /fio/tnakamura/ninja/1/bin/../lib/clang/3.6.0/include -nostdsysteminc
>>> >> -fsyntax-only -verify -triple x86_64-unknown-linux-gnu -std=c++11
>>> >> -ftemplate-depth 16 -fcxx-exceptions -fexceptions
>>> >>
>>> >>
>>> /fio/tnakamura/ninja/llvm-project/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
>>> >> 1. ==9809==
>>> >> ==9809== Process terminating with default action of signal 11
>>> (SIGSEGV)
>>> >> ==9809== General Protection Fault
>>> >> ==9809== at 0x233CAAF:
>>> >> ComputeLineNumbers(clang::DiagnosticsEngine&,
>>> >> clang::SrcMgr::ContentCache*,
>>> >> llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&,
>>> >> clang::SourceManager const&, bool&) (emmintrin.h:606)
>>> >> ==9809== by 0x233D0E0:
>>> >> clang::SourceManager::getLineNumber(clang::FileID, unsigned int,
>>> >> bool*) const (SourceManager.cpp:1307)
>>> >> ==9809== by 0x233D6E7:
>>> >> clang::SourceManager::getPresumedLoc(clang::SourceLocation, bool)
>>> >> const (SourceManager.cpp:1470)
>>> >> ==9809== by 0x233657C:
>>> >> clang::SourceLocation::print(llvm::raw_ostream&, clang::SourceManager
>>> >> const&) const (SourceLocation.cpp:45)
>>> >> ==9809== by 0x31EDF16: (anonymous
>>> >> namespace)::PrettyStackTraceParserEntry::print(llvm::raw_ostream&)
>>> >> const (ParseAST.cpp:57)
>>> >> ==9809== by 0x2202BE2: PrintStack(llvm::PrettyStackTraceEntry
>>> >> const*, llvm::raw_ostream&) (PrettyStackTrace.cpp:40)
>>> >> ==9809== by 0x2202B90: PrintStack(llvm::PrettyStackTraceEntry
>>> >> const*, llvm::raw_ostream&) (PrettyStackTrace.cpp:36)
>>> >> ==9809== by 0x2202B90: PrintStack(llvm::PrettyStackTraceEntry
>>> >> const*, llvm::raw_ostream&) (PrettyStackTrace.cpp:36)
>>> >> ==9809== by 0x2202B90: PrintStack(llvm::PrettyStackTraceEntry
>>> >> const*, llvm::raw_ostream&) (PrettyStackTrace.cpp:36)
>>> >> ==9809== by 0x2202C56: PrintCurStackTrace(llvm::raw_ostream&)
>>> >> (PrettyStackTrace.cpp:54)
>>> >> ==9809== by 0x2202C80: CrashHandler(void*)
>>> (PrettyStackTrace.cpp:79)
>>> >> ==9809== by 0x223B42D: SignalHandler(int) (Signals.inc:199)
>>> >>
>>> >>
>>> /fio/tnakamura/ninja/1/tools/clang/test/SemaTemplate/Output/instantiate-exception-spec-cxx11.cpp.script:
>>> >> line 1: 9809 Segmentation fault
>>> >> /home/tnakamura/fio/ninja/1/./bin/clang -cc1 -internal-isystem
>>> >> /fio/tnakamura/ninja/1/bin/../lib/clang/3.6.0/include -nostdsysteminc
>>> >> -fsyntax-only -verify -triple x86_64-unknown-linux-gnu -std=c++11
>>> >> -ftemplate-depth 16 -fcxx-exceptions -fexceptions
>>> >>
>>> >>
>>> /fio/tnakamura/ninja/llvm-project/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
>>> >>
>>> >> --
>>> >>
>>> >> 2014-10-17 8:00 GMT+09:00 Richard Smith <richard-llvm at metafoo.co.uk>:
>>> >> > Author: rsmith
>>> >> > Date: Thu Oct 16 18:00:46 2014
>>> >> > New Revision: 219977
>>> >> >
>>> >> > URL: http://llvm.org/viewvc/llvm-project?rev=219977&view=rev
>>> >> > Log:
>>> >> > Re-commit r217995 and follow-up patches (r217997, r218011, r218053).
>>> >> > These were
>>> >> > reverted in r218058 because they triggered a rejects-valid bug in
>>> MSVC.
>>> >> >
>>> >> > Original commit message from r217995:
>>> >> >
>>> >> > Instantiate exception specifications when instantiating function
>>> types
>>> >> > (other
>>> >> > than the type of a function declaration). We previously didn't
>>> >> > instantiate
>>> >> > these at all! This also covers the pathological case where the only
>>> >> > mention of
>>> >> > a parameter pack is within the exception specification; this gives
>>> us a
>>> >> > second
>>> >> > way (other than alias templates) to reach the horrible state where a
>>> >> > type
>>> >> > contains an unexpanded pack, but its canonical type does not.
>>> >> >
>>> >> > Modified:
>>> >> > cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
>>> >> > cfe/trunk/include/clang/AST/Expr.h
>>> >> > cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
>>> >> > cfe/trunk/include/clang/AST/Type.h
>>> >> > cfe/trunk/include/clang/Sema/Sema.h
>>> >> > cfe/trunk/lib/AST/Type.cpp
>>> >> > cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>>> >> > cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
>>> >> > cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
>>> >> > cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
>>> >> > cfe/trunk/lib/Sema/SemaType.cpp
>>> >> > cfe/trunk/lib/Sema/TreeTransform.h
>>> >> > cfe/trunk/test/CXX/except/except.spec/p1.cpp
>>> >> > cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
>>> >> > cfe/trunk/test/SemaTemplate/instantiate-exception-spec.cpp
>>> >> >
>>> >> > Modified: cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original)
>>> >> > +++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h Thu Oct 16
>>> >> > 18:00:46 2014
>>> >> > @@ -878,6 +878,9 @@ DEF_TRAVERSE_TYPE(FunctionProtoType, {
>>> >> > for (const auto &E : T->exceptions()) {
>>> >> > TRY_TO(TraverseType(E));
>>> >> > }
>>> >> > +
>>> >> > + if (Expr *NE = T->getNoexceptExpr())
>>> >> > + TRY_TO(TraverseStmt(NE));
>>> >> > })
>>> >> >
>>> >> > DEF_TRAVERSE_TYPE(UnresolvedUsingType, {})
>>> >> > @@ -1086,6 +1089,9 @@ DEF_TRAVERSE_TYPELOC(FunctionProtoType,
>>> >> > for (const auto &E : T->exceptions()) {
>>> >> > TRY_TO(TraverseType(E));
>>> >> > }
>>> >> > +
>>> >> > + if (Expr *NE = T->getNoexceptExpr())
>>> >> > + TRY_TO(TraverseStmt(NE));
>>> >> > })
>>> >> >
>>> >> > DEF_TRAVERSE_TYPELOC(UnresolvedUsingType, {})
>>> >> > @@ -2125,21 +2131,29 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> >> > TRY_TO(TraverseLambdaCapture(S, C));
>>> >> > }
>>> >> >
>>> >> > - if (S->hasExplicitParameters() || S->hasExplicitResultType()) {
>>> >> > - TypeLoc TL =
>>> >> > S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
>>> >> > - if (S->hasExplicitParameters() && S->hasExplicitResultType()) {
>>> >> > - // Visit the whole type.
>>> >> > - TRY_TO(TraverseTypeLoc(TL));
>>> >> > - } else if (FunctionProtoTypeLoc Proto =
>>> >> > TL.getAs<FunctionProtoTypeLoc>()) {
>>> >> > - if (S->hasExplicitParameters()) {
>>> >> > - // Visit parameters.
>>> >> > - for (unsigned I = 0, N = Proto.getNumParams(); I != N;
>>> ++I) {
>>> >> > - TRY_TO(TraverseDecl(Proto.getParam(I)));
>>> >> > - }
>>> >> > - } else {
>>> >> > - TRY_TO(TraverseTypeLoc(Proto.getReturnLoc()));
>>> >> > + TypeLoc TL =
>>> S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
>>> >> > + FunctionProtoTypeLoc Proto = TL.castAs<FunctionProtoTypeLoc>();
>>> >> > +
>>> >> > + if (S->hasExplicitParameters() && S->hasExplicitResultType()) {
>>> >> > + // Visit the whole type.
>>> >> > + TRY_TO(TraverseTypeLoc(TL));
>>> >> > + } else {
>>> >> > + if (S->hasExplicitParameters()) {
>>> >> > + // Visit parameters.
>>> >> > + for (unsigned I = 0, N = Proto.getNumParams(); I != N; ++I) {
>>> >> > + TRY_TO(TraverseDecl(Proto.getParam(I)));
>>> >> > }
>>> >> > + } else if (S->hasExplicitResultType()) {
>>> >> > + TRY_TO(TraverseTypeLoc(Proto.getReturnLoc()));
>>> >> > }
>>> >> > +
>>> >> > + auto *T = Proto.getTypePtr();
>>> >> > + for (const auto &E : T->exceptions()) {
>>> >> > + TRY_TO(TraverseType(E));
>>> >> > + }
>>> >> > +
>>> >> > + if (Expr *NE = T->getNoexceptExpr())
>>> >> > + TRY_TO(TraverseStmt(NE));
>>> >> > }
>>> >> >
>>> >> > TRY_TO(TraverseLambdaBody(S));
>>> >> >
>>> >> > Modified: cfe/trunk/include/clang/AST/Expr.h
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/include/clang/AST/Expr.h (original)
>>> >> > +++ cfe/trunk/include/clang/AST/Expr.h Thu Oct 16 18:00:46 2014
>>> >> > @@ -2678,20 +2678,23 @@ private:
>>> >> > }
>>> >> >
>>> >> > protected:
>>> >> > - CastExpr(StmtClass SC, QualType ty, ExprValueKind VK,
>>> >> > - const CastKind kind, Expr *op, unsigned BasePathSize) :
>>> >> > - Expr(SC, ty, VK, OK_Ordinary,
>>> >> > - // Cast expressions are type-dependent if the type is
>>> >> > - // dependent (C++ [temp.dep.expr]p3).
>>> >> > - ty->isDependentType(),
>>> >> > - // Cast expressions are value-dependent if the type is
>>> >> > - // dependent or if the subexpression is value-dependent.
>>> >> > - ty->isDependentType() || (op && op->isValueDependent()),
>>> >> > - (ty->isInstantiationDependentType() ||
>>> >> > - (op && op->isInstantiationDependent())),
>>> >> > - (ty->containsUnexpandedParameterPack() ||
>>> >> > - (op && op->containsUnexpandedParameterPack()))),
>>> >> > - Op(op) {
>>> >> > + CastExpr(StmtClass SC, QualType ty, ExprValueKind VK, const
>>> CastKind
>>> >> > kind,
>>> >> > + Expr *op, unsigned BasePathSize)
>>> >> > + : Expr(SC, ty, VK, OK_Ordinary,
>>> >> > + // Cast expressions are type-dependent if the type is
>>> >> > + // dependent (C++ [temp.dep.expr]p3).
>>> >> > + ty->isDependentType(),
>>> >> > + // Cast expressions are value-dependent if the type is
>>> >> > + // dependent or if the subexpression is
>>> value-dependent.
>>> >> > + ty->isDependentType() || (op &&
>>> op->isValueDependent()),
>>> >> > + (ty->isInstantiationDependentType() ||
>>> >> > + (op && op->isInstantiationDependent())),
>>> >> > + // An implicit cast expression doesn't (lexically)
>>> contain
>>> >> > an
>>> >> > + // unexpanded pack, even if its target type does.
>>> >> > + ((SC != ImplicitCastExprClass &&
>>> >> > + ty->containsUnexpandedParameterPack()) ||
>>> >> > + (op && op->containsUnexpandedParameterPack()))),
>>> >> > + Op(op) {
>>> >> > assert(kind != CK_Invalid && "creating cast with invalid cast
>>> >> > kind");
>>> >> > CastExprBits.Kind = kind;
>>> >> > setBasePathSize(BasePathSize);
>>> >> >
>>> >> > Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
>>> >> > +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Thu Oct 16
>>> >> > 18:00:46 2014
>>> >> > @@ -943,6 +943,9 @@ DEF_TRAVERSE_TYPE(FunctionProtoType, {
>>> >> > for (const auto &E : T->exceptions()) {
>>> >> > TRY_TO(TraverseType(E));
>>> >> > }
>>> >> > +
>>> >> > + if (Expr *NE = T->getNoexceptExpr())
>>> >> > + TRY_TO(TraverseStmt(NE));
>>> >> > })
>>> >> >
>>> >> > DEF_TRAVERSE_TYPE(UnresolvedUsingType, {})
>>> >> > @@ -1151,6 +1154,9 @@ DEF_TRAVERSE_TYPELOC(FunctionProtoType,
>>> >> > for (const auto &E : T->exceptions()) {
>>> >> > TRY_TO(TraverseType(E));
>>> >> > }
>>> >> > +
>>> >> > + if (Expr *NE = T->getNoexceptExpr())
>>> >> > + TRY_TO(TraverseStmt(NE));
>>> >> > })
>>> >> >
>>> >> > DEF_TRAVERSE_TYPELOC(UnresolvedUsingType, {})
>>> >> > @@ -2147,21 +2153,29 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> >> > TRY_TO(TraverseLambdaCapture(S, C));
>>> >> > }
>>> >> >
>>> >> > - if (S->hasExplicitParameters() || S->hasExplicitResultType()) {
>>> >> > - TypeLoc TL =
>>> >> > S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
>>> >> > - if (S->hasExplicitParameters() && S->hasExplicitResultType()) {
>>> >> > - // Visit the whole type.
>>> >> > - TRY_TO(TraverseTypeLoc(TL));
>>> >> > - } else if (FunctionProtoTypeLoc Proto =
>>> >> > TL.getAs<FunctionProtoTypeLoc>()) {
>>> >> > - if (S->hasExplicitParameters()) {
>>> >> > - // Visit parameters.
>>> >> > - for (unsigned I = 0, N = Proto.getNumParams(); I != N;
>>> ++I) {
>>> >> > - TRY_TO(TraverseDecl(Proto.getParam(I)));
>>> >> > - }
>>> >> > - } else {
>>> >> > - TRY_TO(TraverseTypeLoc(Proto.getReturnLoc()));
>>> >> > + TypeLoc TL =
>>> S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
>>> >> > + FunctionProtoTypeLoc Proto = TL.castAs<FunctionProtoTypeLoc>();
>>> >> > +
>>> >> > + if (S->hasExplicitParameters() && S->hasExplicitResultType()) {
>>> >> > + // Visit the whole type.
>>> >> > + TRY_TO(TraverseTypeLoc(TL));
>>> >> > + } else {
>>> >> > + if (S->hasExplicitParameters()) {
>>> >> > + // Visit parameters.
>>> >> > + for (unsigned I = 0, N = Proto.getNumParams(); I != N; ++I) {
>>> >> > + TRY_TO(TraverseDecl(Proto.getParam(I)));
>>> >> > }
>>> >> > + } else if (S->hasExplicitResultType()) {
>>> >> > + TRY_TO(TraverseTypeLoc(Proto.getReturnLoc()));
>>> >> > }
>>> >> > +
>>> >> > + auto *T = Proto.getTypePtr();
>>> >> > + for (const auto &E : T->exceptions()) {
>>> >> > + TRY_TO(TraverseType(E));
>>> >> > + }
>>> >> > +
>>> >> > + if (Expr *NE = T->getNoexceptExpr())
>>> >> > + TRY_TO(TraverseStmt(NE));
>>> >> > }
>>> >> >
>>> >> > TRY_TO(TraverseLambdaBody(S));
>>> >> >
>>> >> > Modified: cfe/trunk/include/clang/AST/Type.h
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/include/clang/AST/Type.h (original)
>>> >> > +++ cfe/trunk/include/clang/AST/Type.h Thu Oct 16 18:00:46 2014
>>> >> > @@ -3012,6 +3012,8 @@ public:
>>> >> > bool hasNoexceptExceptionSpec() const {
>>> >> > return isNoexceptExceptionSpec(getExceptionSpecType());
>>> >> > }
>>> >> > + /// \brief Return whether this function has a dependent exception
>>> >> > spec.
>>> >> > + bool hasDependentExceptionSpec() const;
>>> >> > /// \brief Result type of getNoexceptSpec().
>>> >> > enum NoexceptResult {
>>> >> > NR_NoNoexcept, ///< There is no noexcept specifier.
>>> >> > @@ -5247,8 +5249,8 @@ template <typename T> const T *Type::cas
>>> >> > ArrayType_cannot_be_used_with_getAs<T> at;
>>> >> > (void) at;
>>> >> >
>>> >> > - assert(isa<T>(CanonicalType));
>>> >> > if (const T *ty = dyn_cast<T>(this)) return ty;
>>> >> > + assert(isa<T>(CanonicalType));
>>> >> > return cast<T>(getUnqualifiedDesugaredType());
>>> >> > }
>>> >> >
>>> >> >
>>> >> > Modified: cfe/trunk/include/clang/Sema/Sema.h
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/include/clang/Sema/Sema.h (original)
>>> >> > +++ cfe/trunk/include/clang/Sema/Sema.h Thu Oct 16 18:00:46 2014
>>> >> > @@ -4036,7 +4036,8 @@ public:
>>> >> >
>>> >> > /// \brief Check the given exception-specification and update the
>>> >> > /// exception specification information with the results.
>>> >> > - void checkExceptionSpecification(ExceptionSpecificationType EST,
>>> >> > + void checkExceptionSpecification(bool IsTopLevel,
>>> >> > + ExceptionSpecificationType EST,
>>> >> > ArrayRef<ParsedType>
>>> >> > DynamicExceptions,
>>> >> > ArrayRef<SourceRange>
>>> >> > DynamicExceptionRanges,
>>> >> > Expr *NoexceptExpr,
>>> >> > @@ -6675,6 +6676,8 @@ public:
>>> >> > DeclarationName Entity,
>>> >> > CXXRecordDecl *ThisContext,
>>> >> > unsigned ThisTypeQuals);
>>> >> > + void SubstExceptionSpec(FunctionDecl *New, const
>>> FunctionProtoType
>>> >> > *Proto,
>>> >> > + const MultiLevelTemplateArgumentList
>>> &Args);
>>> >> > ParmVarDecl *SubstParmVarDecl(ParmVarDecl *D,
>>> >> > const MultiLevelTemplateArgumentList
>>> >> > &TemplateArgs,
>>> >> > int indexAdjustment,
>>> >> >
>>> >> > Modified: cfe/trunk/lib/AST/Type.cpp
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/lib/AST/Type.cpp (original)
>>> >> > +++ cfe/trunk/lib/AST/Type.cpp Thu Oct 16 18:00:46 2014
>>> >> > @@ -1623,9 +1623,9 @@ FunctionProtoType::FunctionProtoType(Qua
>>> >> > QualType *exnSlot = argSlot + NumParams;
>>> >> > unsigned I = 0;
>>> >> > for (QualType ExceptionType : epi.ExceptionSpec.Exceptions) {
>>> >> > - if (ExceptionType->isDependentType())
>>> >> > - setDependent();
>>> >> > - else if (ExceptionType->isInstantiationDependentType())
>>> >> > + // Note that a dependent exception specification does *not*
>>> make
>>> >> > + // a type dependent; it's not even part of the C++ type
>>> system.
>>> >> > + if (ExceptionType->isInstantiationDependentType())
>>> >> > setInstantiationDependent();
>>> >> >
>>> >> > if (ExceptionType->containsUnexpandedParameterPack())
>>> >> > @@ -1639,11 +1639,12 @@ FunctionProtoType::FunctionProtoType(Qua
>>> >> > *noexSlot = epi.ExceptionSpec.NoexceptExpr;
>>> >> >
>>> >> > if (epi.ExceptionSpec.NoexceptExpr) {
>>> >> > - if (epi.ExceptionSpec.NoexceptExpr->isValueDependent()
>>> >> > - || epi.ExceptionSpec.NoexceptExpr->isTypeDependent())
>>> >> > - setDependent();
>>> >> > - else if
>>> >> > (epi.ExceptionSpec.NoexceptExpr->isInstantiationDependent())
>>> >> > + if (epi.ExceptionSpec.NoexceptExpr->isValueDependent() ||
>>> >> > +
>>> epi.ExceptionSpec.NoexceptExpr->isInstantiationDependent())
>>> >> > setInstantiationDependent();
>>> >> > +
>>> >> > + if
>>> >> > (epi.ExceptionSpec.NoexceptExpr->containsUnexpandedParameterPack())
>>> >> > + setContainsUnexpandedParameterPack();
>>> >> > }
>>> >> > } else if (getExceptionSpecType() == EST_Uninstantiated) {
>>> >> > // Store the function decl from which we will resolve our
>>> >> > @@ -1669,6 +1670,18 @@ FunctionProtoType::FunctionProtoType(Qua
>>> >> > }
>>> >> > }
>>> >> >
>>> >> > +bool FunctionProtoType::hasDependentExceptionSpec() const {
>>> >> > + if (Expr *NE = getNoexceptExpr())
>>> >> > + return NE->isValueDependent();
>>> >> > + for (QualType ET : exceptions())
>>> >> > + // A pack expansion with a non-dependent pattern is still
>>> >> > dependent,
>>> >> > + // because we don't know whether the pattern is in the
>>> exception
>>> >> > spec
>>> >> > + // or not (that depends on whether the pack has 0 expansions).
>>> >> > + if (ET->isDependentType() || ET->getAs<PackExpansionType>())
>>> >> > + return true;
>>> >> > + return false;
>>> >> > +}
>>> >> > +
>>> >> > FunctionProtoType::NoexceptResult
>>> >> > FunctionProtoType::getNoexceptSpec(const ASTContext &ctx) const {
>>> >> > ExceptionSpecificationType est = getExceptionSpecType();
>>> >> >
>>> >> > Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
>>> >> > +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Oct 16 18:00:46 2014
>>> >> > @@ -13168,13 +13168,12 @@ bool Sema::checkThisInStaticMemberFuncti
>>> >> > return false;
>>> >> > }
>>> >> >
>>> >> > -void
>>> >> > -Sema::checkExceptionSpecification(ExceptionSpecificationType EST,
>>> >> > - ArrayRef<ParsedType>
>>> >> > DynamicExceptions,
>>> >> > - ArrayRef<SourceRange>
>>> >> > DynamicExceptionRanges,
>>> >> > - Expr *NoexceptExpr,
>>> >> > - SmallVectorImpl<QualType>
>>> >> > &Exceptions,
>>> >> > -
>>> FunctionProtoType::ExceptionSpecInfo
>>> >> > &ESI) {
>>> >> > +void Sema::checkExceptionSpecification(
>>> >> > + bool IsTopLevel, ExceptionSpecificationType EST,
>>> >> > + ArrayRef<ParsedType> DynamicExceptions,
>>> >> > + ArrayRef<SourceRange> DynamicExceptionRanges, Expr
>>> *NoexceptExpr,
>>> >> > + SmallVectorImpl<QualType> &Exceptions,
>>> >> > + FunctionProtoType::ExceptionSpecInfo &ESI) {
>>> >> > Exceptions.clear();
>>> >> > ESI.Type = EST;
>>> >> > if (EST == EST_Dynamic) {
>>> >> > @@ -13183,13 +13182,15 @@ Sema::checkExceptionSpecification(Except
>>> >> > // FIXME: Preserve type source info.
>>> >> > QualType ET = GetTypeFromParser(DynamicExceptions[ei]);
>>> >> >
>>> >> > - SmallVector<UnexpandedParameterPack, 2> Unexpanded;
>>> >> > - collectUnexpandedParameterPacks(ET, Unexpanded);
>>> >> > - if (!Unexpanded.empty()) {
>>> >> > -
>>> >> >
>>> DiagnoseUnexpandedParameterPacks(DynamicExceptionRanges[ei].getBegin(),
>>> >> > - UPPC_ExceptionType,
>>> >> > - Unexpanded);
>>> >> > - continue;
>>> >> > + if (IsTopLevel) {
>>> >> > + SmallVector<UnexpandedParameterPack, 2> Unexpanded;
>>> >> > + collectUnexpandedParameterPacks(ET, Unexpanded);
>>> >> > + if (!Unexpanded.empty()) {
>>> >> > + DiagnoseUnexpandedParameterPacks(
>>> >> > + DynamicExceptionRanges[ei].getBegin(),
>>> >> > UPPC_ExceptionType,
>>> >> > + Unexpanded);
>>> >> > + continue;
>>> >> > + }
>>> >> > }
>>> >> >
>>> >> > // Check that the type is valid for an exception spec, and
>>> >> > @@ -13208,7 +13209,8 @@ Sema::checkExceptionSpecification(Except
>>> >> >
>>> NoexceptExpr->getType()->getCanonicalTypeUnqualified() ==
>>> >> > Context.BoolTy) &&
>>> >> > "Parser should have made sure that the expression is
>>> >> > boolean");
>>> >> > - if (NoexceptExpr &&
>>> >> > DiagnoseUnexpandedParameterPack(NoexceptExpr)) {
>>> >> > + if (IsTopLevel && NoexceptExpr &&
>>> >> > + DiagnoseUnexpandedParameterPack(NoexceptExpr)) {
>>> >> > ESI.Type = EST_BasicNoexcept;
>>> >> > return;
>>> >> > }
>>> >> >
>>> >> > Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original)
>>> >> > +++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Thu Oct 16 18:00:46
>>> 2014
>>> >> > @@ -720,10 +720,11 @@ static bool CheckSpecForTypesEquivalent(
>>> >> > /// assignment and override compatibility check. We do not check
>>> the
>>> >> > parameters
>>> >> > /// of parameter function pointers recursively, as no sane
>>> programmer
>>> >> > would
>>> >> > /// even be able to write such a function type.
>>> >> > -bool Sema::CheckParamExceptionSpec(const PartialDiagnostic &
>>> NoteID,
>>> >> > - const FunctionProtoType *Target, SourceLocation TargetLoc,
>>> >> > - const FunctionProtoType *Source, SourceLocation SourceLoc)
>>> >> > -{
>>> >> > +bool Sema::CheckParamExceptionSpec(const PartialDiagnostic &NoteID,
>>> >> > + const FunctionProtoType *Target,
>>> >> > + SourceLocation TargetLoc,
>>> >> > + const FunctionProtoType *Source,
>>> >> > + SourceLocation SourceLoc) {
>>> >> > if (CheckSpecForTypesEquivalent(
>>> >> > *this, PDiag(diag::err_deep_exception_specs_differ) << 0,
>>> >> > PDiag(),
>>> >> > Target->getReturnType(), TargetLoc,
>>> Source->getReturnType(),
>>> >> > @@ -744,23 +745,30 @@ bool Sema::CheckParamExceptionSpec(const
>>> >> > return false;
>>> >> > }
>>> >> >
>>> >> > -bool Sema::CheckExceptionSpecCompatibility(Expr *From, QualType
>>> ToType)
>>> >> > -{
>>> >> > +bool Sema::CheckExceptionSpecCompatibility(Expr *From, QualType
>>> ToType)
>>> >> > {
>>> >> > // First we check for applicability.
>>> >> > // Target type must be a function, function pointer or function
>>> >> > reference.
>>> >> > const FunctionProtoType *ToFunc = GetUnderlyingFunction(ToType);
>>> >> > - if (!ToFunc)
>>> >> > + if (!ToFunc || ToFunc->hasDependentExceptionSpec())
>>> >> > return false;
>>> >> >
>>> >> > // SourceType must be a function or function pointer.
>>> >> > const FunctionProtoType *FromFunc =
>>> >> > GetUnderlyingFunction(From->getType());
>>> >> > - if (!FromFunc)
>>> >> > + if (!FromFunc || FromFunc->hasDependentExceptionSpec())
>>> >> > return false;
>>> >> >
>>> >> > // Now we've got the correct types on both sides, check their
>>> >> > compatibility.
>>> >> > // This means that the source of the conversion can only throw a
>>> >> > subset of
>>> >> > // the exceptions of the target, and any exception specs on
>>> arguments
>>> >> > or
>>> >> > // return types must be equivalent.
>>> >> > + //
>>> >> > + // FIXME: If there is a nested dependent exception
>>> specification, we
>>> >> > should
>>> >> > + // not be checking it here. This is fine:
>>> >> > + // template<typename T> void f() {
>>> >> > + // void (*p)(void (*) throw(T));
>>> >> > + // void (*q)(void (*) throw(int)) = p;
>>> >> > + // }
>>> >> > + // ... because it might be instantiated with T=int.
>>> >> > return
>>> >> >
>>> CheckExceptionSpecSubset(PDiag(diag::err_incompatible_exception_specs),
>>> >> > PDiag(), ToFunc,
>>> >> >
>>> From->getSourceRange().getBegin(),
>>> >> >
>>> >> > Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
>>> >> > +++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Thu Oct 16
>>> 18:00:46
>>> >> > 2014
>>> >> > @@ -791,11 +791,17 @@ namespace {
>>> >> > ExprResult TransformFunctionParmPackExpr(FunctionParmPackExpr
>>> *E);
>>> >> >
>>> >> > QualType TransformFunctionProtoType(TypeLocBuilder &TLB,
>>> >> > - FunctionProtoTypeLoc TL);
>>> >> > + FunctionProtoTypeLoc TL) {
>>> >> > + // Call the base version; it will forward to our overridden
>>> >> > version below.
>>> >> > + return inherited::TransformFunctionProtoType(TLB, TL);
>>> >> > + }
>>> >> > +
>>> >> > + template<typename Fn>
>>> >> > QualType TransformFunctionProtoType(TypeLocBuilder &TLB,
>>> >> > FunctionProtoTypeLoc TL,
>>> >> > CXXRecordDecl *ThisContext,
>>> >> > - unsigned ThisTypeQuals);
>>> >> > + unsigned ThisTypeQuals,
>>> >> > + Fn TransformExceptionSpec);
>>> >> >
>>> >> > ParmVarDecl *TransformFunctionTypeParam(ParmVarDecl *OldParm,
>>> >> > int indexAdjustment,
>>> >> > @@ -1327,21 +1333,16 @@ ExprResult TemplateInstantiator::Transfo
>>> >> > E->getParam());
>>> >> > }
>>> >> >
>>> >> > -QualType
>>> >> > TemplateInstantiator::TransformFunctionProtoType(TypeLocBuilder
>>> &TLB,
>>> >> > -
>>> >> > FunctionProtoTypeLoc TL) {
>>> >> > - // We need a local instantiation scope for this function
>>> prototype.
>>> >> > - LocalInstantiationScope Scope(SemaRef,
>>> >> > /*CombineWithOuterScope=*/true);
>>> >> > - return inherited::TransformFunctionProtoType(TLB, TL);
>>> >> > -}
>>> >> > -
>>> >> > +template<typename Fn>
>>> >> > QualType
>>> >> > TemplateInstantiator::TransformFunctionProtoType(TypeLocBuilder
>>> &TLB,
>>> >> > FunctionProtoTypeLoc TL,
>>> >> > CXXRecordDecl *ThisContext,
>>> >> > - unsigned ThisTypeQuals) {
>>> >> > + unsigned ThisTypeQuals,
>>> >> > + Fn TransformExceptionSpec) {
>>> >> > // We need a local instantiation scope for this function
>>> prototype.
>>> >> > LocalInstantiationScope Scope(SemaRef,
>>> >> > /*CombineWithOuterScope=*/true);
>>> >> > - return inherited::TransformFunctionProtoType(TLB, TL,
>>> ThisContext,
>>> >> > - ThisTypeQuals);
>>> >> > + return inherited::TransformFunctionProtoType(
>>> >> > + TLB, TL, ThisContext, ThisTypeQuals, TransformExceptionSpec);
>>> >> > }
>>> >> >
>>> >> > ParmVarDecl *
>>> >> > @@ -1576,7 +1577,8 @@ static bool NeedsInstantiationAsFunction
>>> >> >
>>> >> > /// A form of SubstType intended specifically for instantiating the
>>> >> > /// type of a FunctionDecl. Its purpose is solely to force the
>>> >> > -/// instantiation of default-argument expressions.
>>> >> > +/// instantiation of default-argument expressions and to avoid
>>> >> > +/// instantiating an exception-specification.
>>> >> > TypeSourceInfo *Sema::SubstFunctionDeclType(TypeSourceInfo *T,
>>> >> > const
>>> MultiLevelTemplateArgumentList
>>> >> > &Args,
>>> >> > SourceLocation Loc,
>>> >> > @@ -1599,9 +1601,17 @@ TypeSourceInfo *Sema::SubstFunctionDeclT
>>> >> >
>>> >> > QualType Result;
>>> >> >
>>> >> > - if (FunctionProtoTypeLoc Proto =
>>> TL.getAs<FunctionProtoTypeLoc>()) {
>>> >> > - Result = Instantiator.TransformFunctionProtoType(TLB, Proto,
>>> >> > ThisContext,
>>> >> > -
>>> ThisTypeQuals);
>>> >> > + if (FunctionProtoTypeLoc Proto =
>>> >> > + TL.IgnoreParens().getAs<FunctionProtoTypeLoc>()) {
>>> >> > + // Instantiate the type, other than its exception
>>> specification.
>>> >> > The
>>> >> > + // exception specification is instantiated in
>>> >> > InitFunctionInstantiation
>>> >> > + // once we've built the FunctionDecl.
>>> >> > + // FIXME: Set the exception specification to EST_Uninstantiated
>>> >> > here,
>>> >> > + // instead of rebuilding the function type again later.
>>> >> > + Result = Instantiator.TransformFunctionProtoType(
>>> >> > + TLB, Proto, ThisContext, ThisTypeQuals,
>>> >> > + [](FunctionProtoType::ExceptionSpecInfo &ESI,
>>> >> > + bool &Changed) { return false; });
>>> >> > } else {
>>> >> > Result = Instantiator.TransformType(TLB, TL);
>>> >> > }
>>> >> > @@ -1611,6 +1621,26 @@ TypeSourceInfo *Sema::SubstFunctionDeclT
>>> >> > return TLB.getTypeSourceInfo(Context, Result);
>>> >> > }
>>> >> >
>>> >> > +void Sema::SubstExceptionSpec(FunctionDecl *New, const
>>> >> > FunctionProtoType *Proto,
>>> >> > + const MultiLevelTemplateArgumentList
>>> >> > &Args) {
>>> >> > + FunctionProtoType::ExceptionSpecInfo ESI =
>>> >> > + Proto->getExtProtoInfo().ExceptionSpec;
>>> >> > + assert(ESI.Type != EST_Uninstantiated);
>>> >> > +
>>> >> > + TemplateInstantiator Instantiator(*this, Args,
>>> New->getLocation(),
>>> >> > + New->getDeclName());
>>> >> > +
>>> >> > + SmallVector<QualType, 4> ExceptionStorage;
>>> >> > + bool Changed = false;
>>> >> > + if (Instantiator.TransformExceptionSpec(
>>> >> > + New->getTypeSourceInfo()->getTypeLoc().getLocEnd(), ESI,
>>> >> > + ExceptionStorage, Changed))
>>> >> > + // On error, recover by dropping the exception specification.
>>> >> > + ESI.Type = EST_None;
>>> >> > +
>>> >> > + UpdateExceptionSpec(New, ESI);
>>> >> > +}
>>> >> > +
>>> >> > ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm,
>>> >> > const MultiLevelTemplateArgumentList
>>> >> > &TemplateArgs,
>>> >> > int indexAdjustment,
>>> >> >
>>> >> > Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
>>> >> > +++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Thu Oct 16
>>> >> > 18:00:46 2014
>>> >> > @@ -3056,7 +3056,7 @@ TemplateDeclInstantiator::SubstFunctionT
>>> >> > /// Introduce the instantiated function parameters into the local
>>> >> > /// instantiation scope, and set the parameter names to those used
>>> >> > /// in the template.
>>> >> > -static void addInstantiatedParametersToScope(Sema &S, FunctionDecl
>>> >> > *Function,
>>> >> > +static bool addInstantiatedParametersToScope(Sema &S, FunctionDecl
>>> >> > *Function,
>>> >> > const FunctionDecl
>>> >> > *PatternDecl,
>>> >> >
>>> LocalInstantiationScope
>>> >> > &Scope,
>>> >> > const MultiLevelTemplateArgumentList
>>> >> > &TemplateArgs) {
>>> >> > @@ -3067,15 +3067,22 @@ static void addInstantiatedParametersToS
>>> >> > // Simple case: not a parameter pack.
>>> >> > assert(FParamIdx < Function->getNumParams());
>>> >> > ParmVarDecl *FunctionParam =
>>> Function->getParamDecl(FParamIdx);
>>> >> > + FunctionParam->setDeclName(PatternParam->getDeclName());
>>> >> > // If the parameter's type is not dependent, update it to
>>> match
>>> >> > the type
>>> >> > // in the pattern. They can differ in top-level
>>> cv-qualifiers,
>>> >> > and we want
>>> >> > // the pattern's type here. If the type is dependent, they
>>> can't
>>> >> > differ,
>>> >> > - // per core issue 1668.
>>> >> > + // per core issue 1668. Substitute into the type from the
>>> >> > pattern, in case
>>> >> > + // it's instantiation-dependent.
>>> >> > // FIXME: Updating the type to work around this is at best
>>> >> > fragile.
>>> >> > - if (!PatternDecl->getType()->isDependentType())
>>> >> > - FunctionParam->setType(PatternParam->getType());
>>> >> > + if (!PatternDecl->getType()->isDependentType()) {
>>> >> > + QualType T = S.SubstType(PatternParam->getType(),
>>> TemplateArgs,
>>> >> > + FunctionParam->getLocation(),
>>> >> > + FunctionParam->getDeclName());
>>> >> > + if (T.isNull())
>>> >> > + return true;
>>> >> > + FunctionParam->setType(T);
>>> >> > + }
>>> >> >
>>> >> > - FunctionParam->setDeclName(PatternParam->getDeclName());
>>> >> > Scope.InstantiatedLocal(PatternParam, FunctionParam);
>>> >> > ++FParamIdx;
>>> >> > continue;
>>> >> > @@ -3087,136 +3094,27 @@ static void addInstantiatedParametersToS
>>> >> > = S.getNumArgumentsInExpansion(PatternParam->getType(),
>>> >> > TemplateArgs);
>>> >> > assert(NumArgumentsInExpansion &&
>>> >> > "should only be called when all template arguments are
>>> >> > known");
>>> >> > + QualType PatternType =
>>> >> > +
>>> >> > PatternParam->getType()->castAs<PackExpansionType>()->getPattern();
>>> >> > for (unsigned Arg = 0; Arg < *NumArgumentsInExpansion; ++Arg) {
>>> >> > ParmVarDecl *FunctionParam =
>>> Function->getParamDecl(FParamIdx);
>>> >> > - if (!PatternDecl->getType()->isDependentType())
>>> >> > - FunctionParam->setType(PatternParam->getType());
>>> >> > -
>>> >> > FunctionParam->setDeclName(PatternParam->getDeclName());
>>> >> > - Scope.InstantiatedLocalPackArg(PatternParam, FunctionParam);
>>> >> > - ++FParamIdx;
>>> >> > - }
>>> >> > - }
>>> >> > -}
>>> >> > -
>>> >> > -static void InstantiateExceptionSpec(Sema &SemaRef, FunctionDecl
>>> *New,
>>> >> > - const FunctionProtoType
>>> *Proto,
>>> >> > - const MultiLevelTemplateArgumentList
>>> >> > &TemplateArgs) {
>>> >> > - assert(Proto->getExceptionSpecType() != EST_Uninstantiated);
>>> >> > -
>>> >> > - // C++11 [expr.prim.general]p3:
>>> >> > - // If a declaration declares a member function or member
>>> function
>>> >> > - // template of a class X, the expression this is a prvalue of
>>> type
>>> >> > - // "pointer to cv-qualifier-seq X" between the optional
>>> >> > cv-qualifer-seq
>>> >> > - // and the end of the function-definition, member-declarator,
>>> or
>>> >> > - // declarator.
>>> >> > - CXXRecordDecl *ThisContext = nullptr;
>>> >> > - unsigned ThisTypeQuals = 0;
>>> >> > - if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(New)) {
>>> >> > - ThisContext = Method->getParent();
>>> >> > - ThisTypeQuals = Method->getTypeQualifiers();
>>> >> > - }
>>> >> > - Sema::CXXThisScopeRAII ThisScope(SemaRef, ThisContext,
>>> ThisTypeQuals,
>>> >> > -
>>> SemaRef.getLangOpts().CPlusPlus11);
>>> >> > -
>>> >> > - // The function has an exception specification or a "noreturn"
>>> >> > - // attribute. Substitute into each of the exception types.
>>> >> > - SmallVector<QualType, 4> Exceptions;
>>> >> > - for (unsigned I = 0, N = Proto->getNumExceptions(); I != N; ++I)
>>> {
>>> >> > - // FIXME: Poor location information!
>>> >> > - if (const PackExpansionType *PackExpansion
>>> >> > - =
>>> Proto->getExceptionType(I)->getAs<PackExpansionType>()) {
>>> >> > - // We have a pack expansion. Instantiate it.
>>> >> > - SmallVector<UnexpandedParameterPack, 2> Unexpanded;
>>> >> > -
>>> >> > SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
>>> >> > - Unexpanded);
>>> >> > - assert(!Unexpanded.empty() &&
>>> >> > - "Pack expansion without parameter packs?");
>>> >> > -
>>> >> > - bool Expand = false;
>>> >> > - bool RetainExpansion = false;
>>> >> > - Optional<unsigned> NumExpansions =
>>> >> > PackExpansion->getNumExpansions();
>>> >> > - if
>>> (SemaRef.CheckParameterPacksForExpansion(New->getLocation(),
>>> >> > - SourceRange(),
>>> >> > - Unexpanded,
>>> >> > - TemplateArgs,
>>> >> > - Expand,
>>> >> > - RetainExpansion,
>>> >> > - NumExpansions))
>>> >> > - break;
>>> >> > -
>>> >> > - if (!Expand) {
>>> >> > - // We can't expand this pack expansion into separate
>>> arguments
>>> >> > yet;
>>> >> > - // just substitute into the pattern and create a new pack
>>> >> > expansion
>>> >> > - // type.
>>> >> > - Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef,
>>> >> > -1);
>>> >> > - QualType T = SemaRef.SubstType(PackExpansion->getPattern(),
>>> >> > - TemplateArgs,
>>> >> > - New->getLocation(),
>>> >> > New->getDeclName());
>>> >> > + if (!PatternDecl->getType()->isDependentType()) {
>>> >> > + Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(S, Arg);
>>> >> > + QualType T = S.SubstType(PatternType, TemplateArgs,
>>> >> > + FunctionParam->getLocation(),
>>> >> > + FunctionParam->getDeclName());
>>> >> > if (T.isNull())
>>> >> > - break;
>>> >> > -
>>> >> > - T = SemaRef.Context.getPackExpansionType(T, NumExpansions);
>>> >> > - Exceptions.push_back(T);
>>> >> > - continue;
>>> >> > - }
>>> >> > -
>>> >> > - // Substitute into the pack expansion pattern for each
>>> template
>>> >> > - bool Invalid = false;
>>> >> > - for (unsigned ArgIdx = 0; ArgIdx != *NumExpansions;
>>> ++ArgIdx) {
>>> >> > - Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef,
>>> >> > ArgIdx);
>>> >> > -
>>> >> > - QualType T = SemaRef.SubstType(PackExpansion->getPattern(),
>>> >> > - TemplateArgs,
>>> >> > - New->getLocation(),
>>> >> > New->getDeclName());
>>> >> > - if (T.isNull()) {
>>> >> > - Invalid = true;
>>> >> > - break;
>>> >> > - }
>>> >> > -
>>> >> > - Exceptions.push_back(T);
>>> >> > + return true;
>>> >> > + FunctionParam->setType(T);
>>> >> > }
>>> >> >
>>> >> > - if (Invalid)
>>> >> > - break;
>>> >> > -
>>> >> > - continue;
>>> >> > - }
>>> >> > -
>>> >> > - QualType T
>>> >> > - = SemaRef.SubstType(Proto->getExceptionType(I), TemplateArgs,
>>> >> > - New->getLocation(), New->getDeclName());
>>> >> > - if (T.isNull() ||
>>> >> > - SemaRef.CheckSpecifiedExceptionType(T, New->getLocation()))
>>> >> > - continue;
>>> >> > -
>>> >> > - Exceptions.push_back(T);
>>> >> > - }
>>> >> > - Expr *NoexceptExpr = nullptr;
>>> >> > - if (Expr *OldNoexceptExpr = Proto->getNoexceptExpr()) {
>>> >> > - EnterExpressionEvaluationContext Unevaluated(SemaRef,
>>> >> > -
>>> >> > Sema::ConstantEvaluated);
>>> >> > - ExprResult E = SemaRef.SubstExpr(OldNoexceptExpr,
>>> TemplateArgs);
>>> >> > - if (E.isUsable())
>>> >> > - E = SemaRef.CheckBooleanCondition(E.get(),
>>> >> > E.get()->getLocStart());
>>> >> > -
>>> >> > - if (E.isUsable()) {
>>> >> > - NoexceptExpr = E.get();
>>> >> > - if (!NoexceptExpr->isTypeDependent() &&
>>> >> > - !NoexceptExpr->isValueDependent())
>>> >> > - NoexceptExpr
>>> >> > - = SemaRef.VerifyIntegerConstantExpression(NoexceptExpr,
>>> >> > - nullptr,
>>> diag::err_noexcept_needs_constant_expression,
>>> >> > - /*AllowFold*/ false).get();
>>> >> > + Scope.InstantiatedLocalPackArg(PatternParam, FunctionParam);
>>> >> > + ++FParamIdx;
>>> >> > }
>>> >> > }
>>> >> >
>>> >> > - FunctionProtoType::ExceptionSpecInfo ESI;
>>> >> > - ESI.Type = Proto->getExceptionSpecType();
>>> >> > - ESI.Exceptions = Exceptions;
>>> >> > - ESI.NoexceptExpr = NoexceptExpr;
>>> >> > -
>>> >> > - SemaRef.UpdateExceptionSpec(New, ESI);
>>> >> > + return false;
>>> >> > }
>>> >> >
>>> >> > void Sema::InstantiateExceptionSpec(SourceLocation
>>> >> > PointOfInstantiation,
>>> >> > @@ -3243,11 +3141,14 @@ void Sema::InstantiateExceptionSpec(Sour
>>> >> > getTemplateInstantiationArgs(Decl, nullptr,
>>> >> > /*RelativeToPrimary*/true);
>>> >> >
>>> >> > FunctionDecl *Template = Proto->getExceptionSpecTemplate();
>>> >> > - addInstantiatedParametersToScope(*this, Decl, Template, Scope,
>>> >> > TemplateArgs);
>>> >> > + if (addInstantiatedParametersToScope(*this, Decl, Template,
>>> Scope,
>>> >> > + TemplateArgs)) {
>>> >> > + UpdateExceptionSpec(Decl, EST_None);
>>> >> > + return;
>>> >> > + }
>>> >> >
>>> >> > - ::InstantiateExceptionSpec(*this, Decl,
>>> >> > -
>>> >> > Template->getType()->castAs<FunctionProtoType>(),
>>> >> > - TemplateArgs);
>>> >> > + SubstExceptionSpec(Decl,
>>> >> > Template->getType()->castAs<FunctionProtoType>(),
>>> >> > + TemplateArgs);
>>> >> > }
>>> >> >
>>> >> > /// \brief Initializes the common fields of an instantiation
>>> function
>>> >> > @@ -3316,7 +3217,7 @@ TemplateDeclInstantiator::InitFunctionIn
>>> >> > New->setType(SemaRef.Context.getFunctionType(
>>> >> > NewProto->getReturnType(), NewProto->getParamTypes(),
>>> EPI));
>>> >> > } else {
>>> >> > - ::InstantiateExceptionSpec(SemaRef, New, Proto,
>>> TemplateArgs);
>>> >> > + SemaRef.SubstExceptionSpec(New, Proto, TemplateArgs);
>>> >> > }
>>> >> > }
>>> >> >
>>> >> > @@ -3506,8 +3407,9 @@ void Sema::InstantiateFunctionDefinition
>>> >> > MultiLevelTemplateArgumentList TemplateArgs =
>>> >> > getTemplateInstantiationArgs(Function, nullptr, false,
>>> >> > PatternDecl);
>>> >> >
>>> >> > - addInstantiatedParametersToScope(*this, Function, PatternDecl,
>>> >> > Scope,
>>> >> > - TemplateArgs);
>>> >> > + if (addInstantiatedParametersToScope(*this, Function,
>>> PatternDecl,
>>> >> > Scope,
>>> >> > + TemplateArgs))
>>> >> > + return;
>>> >> >
>>> >> > // If this is a constructor, instantiate the member
>>> initializers.
>>> >> > if (const CXXConstructorDecl *Ctor =
>>> >> >
>>> >> > Modified: cfe/trunk/lib/Sema/SemaType.cpp
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/lib/Sema/SemaType.cpp (original)
>>> >> > +++ cfe/trunk/lib/Sema/SemaType.cpp Thu Oct 16 18:00:46 2014
>>> >> > @@ -2989,7 +2989,8 @@ static TypeSourceInfo *GetFullTypeForDec
>>> >> > NoexceptExpr = FTI.NoexceptExpr;
>>> >> > }
>>> >> >
>>> >> > - S.checkExceptionSpecification(FTI.getExceptionSpecType(),
>>> >> > +
>>> S.checkExceptionSpecification(D.isFunctionDeclarationContext(),
>>> >> > + FTI.getExceptionSpecType(),
>>> >> > DynamicExceptions,
>>> >> > DynamicExceptionRanges,
>>> >> > NoexceptExpr,
>>> >> >
>>> >> > Modified: cfe/trunk/lib/Sema/TreeTransform.h
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/lib/Sema/TreeTransform.h (original)
>>> >> > +++ cfe/trunk/lib/Sema/TreeTransform.h Thu Oct 16 18:00:46 2014
>>> >> > @@ -563,10 +563,17 @@ public:
>>> >> > QualType Transform##CLASS##Type(TypeLocBuilder &TLB,
>>> CLASS##TypeLoc
>>> >> > T);
>>> >> > #include "clang/AST/TypeLocNodes.def"
>>> >> >
>>> >> > + template<typename Fn>
>>> >> > QualType TransformFunctionProtoType(TypeLocBuilder &TLB,
>>> >> > FunctionProtoTypeLoc TL,
>>> >> > CXXRecordDecl *ThisContext,
>>> >> > - unsigned ThisTypeQuals);
>>> >> > + unsigned ThisTypeQuals,
>>> >> > + Fn TransformExceptionSpec);
>>> >> > +
>>> >> > + bool TransformExceptionSpec(SourceLocation Loc,
>>> >> > + FunctionProtoType::ExceptionSpecInfo
>>> >> > &ESI,
>>> >> > + SmallVectorImpl<QualType>
>>> &Exceptions,
>>> >> > + bool &Changed);
>>> >> >
>>> >> > StmtResult TransformSEHHandler(Stmt *Handler);
>>> >> >
>>> >> > @@ -4550,15 +4557,19 @@ template<typename Derived>
>>> >> > QualType
>>> >> > TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder
>>> &TLB,
>>> >> >
>>> FunctionProtoTypeLoc
>>> >> > TL) {
>>> >> > - return getDerived().TransformFunctionProtoType(TLB, TL, nullptr,
>>> 0);
>>> >> > + SmallVector<QualType, 4> ExceptionStorage;
>>> >> > + return getDerived().TransformFunctionProtoType(
>>> >> > + TLB, TL, nullptr, 0,
>>> >> > + [&](FunctionProtoType::ExceptionSpecInfo &ESI, bool
>>> &Changed) {
>>> >> > + return TransformExceptionSpec(TL.getBeginLoc(), ESI,
>>> >> > ExceptionStorage,
>>> >> > + Changed);
>>> >> > + });
>>> >> > }
>>> >> >
>>> >> > -template<typename Derived>
>>> >> > -QualType
>>> >> > -TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder
>>> &TLB,
>>> >> > -
>>> FunctionProtoTypeLoc
>>> >> > TL,
>>> >> > - CXXRecordDecl
>>> >> > *ThisContext,
>>> >> > - unsigned
>>> >> > ThisTypeQuals) {
>>> >> > +template<typename Derived> template<typename Fn>
>>> >> > +QualType TreeTransform<Derived>::TransformFunctionProtoType(
>>> >> > + TypeLocBuilder &TLB, FunctionProtoTypeLoc TL, CXXRecordDecl
>>> >> > *ThisContext,
>>> >> > + unsigned ThisTypeQuals, Fn TransformExceptionSpec) {
>>> >> > // Transform the parameters and return type.
>>> >> > //
>>> >> > // We are required to instantiate the params and return type in
>>> >> > source order.
>>> >> > @@ -4603,15 +4614,21 @@ TreeTransform<Derived>::TransformFunctio
>>> >> > return QualType();
>>> >> > }
>>> >> >
>>> >> > - // FIXME: Need to transform the exception-specification too.
>>> >> > + FunctionProtoType::ExtProtoInfo EPI = T->getExtProtoInfo();
>>> >> > +
>>> >> > + bool EPIChanged = false;
>>> >> > + if (TransformExceptionSpec(EPI.ExceptionSpec, EPIChanged))
>>> >> > + return QualType();
>>> >> > +
>>> >> > + // FIXME: Need to transform ConsumedParameters for variadic
>>> template
>>> >> > + // expansion.
>>> >> >
>>> >> > QualType Result = TL.getType();
>>> >> > if (getDerived().AlwaysRebuild() || ResultType !=
>>> T->getReturnType()
>>> >> > ||
>>> >> > T->getNumParams() != ParamTypes.size() ||
>>> >> > !std::equal(T->param_type_begin(), T->param_type_end(),
>>> >> > - ParamTypes.begin())) {
>>> >> > - Result = getDerived().RebuildFunctionProtoType(ResultType,
>>> >> > ParamTypes,
>>> >> > -
>>> >> > T->getExtProtoInfo());
>>> >> > + ParamTypes.begin()) || EPIChanged) {
>>> >> > + Result = getDerived().RebuildFunctionProtoType(ResultType,
>>> >> > ParamTypes, EPI);
>>> >> > if (Result.isNull())
>>> >> > return QualType();
>>> >> > }
>>> >> > @@ -4628,6 +4645,107 @@ TreeTransform<Derived>::TransformFunctio
>>> >> > }
>>> >> >
>>> >> > template<typename Derived>
>>> >> > +bool TreeTransform<Derived>::TransformExceptionSpec(
>>> >> > + SourceLocation Loc, FunctionProtoType::ExceptionSpecInfo &ESI,
>>> >> > + SmallVectorImpl<QualType> &Exceptions, bool &Changed) {
>>> >> > + assert(ESI.Type != EST_Uninstantiated && ESI.Type !=
>>> >> > EST_Unevaluated);
>>> >> > +
>>> >> > + // Instantiate a dynamic noexcept expression, if any.
>>> >> > + if (ESI.Type == EST_ComputedNoexcept) {
>>> >> > + EnterExpressionEvaluationContext Unevaluated(getSema(),
>>> >> > +
>>> >> > Sema::ConstantEvaluated);
>>> >> > + ExprResult NoexceptExpr =
>>> >> > getDerived().TransformExpr(ESI.NoexceptExpr);
>>> >> > + if (NoexceptExpr.isInvalid())
>>> >> > + return true;
>>> >> > +
>>> >> > + NoexceptExpr = getSema().CheckBooleanCondition(
>>> >> > + NoexceptExpr.get(), NoexceptExpr.get()->getLocStart());
>>> >> > + if (NoexceptExpr.isInvalid())
>>> >> > + return true;
>>> >> > +
>>> >> > + if (!NoexceptExpr.get()->isValueDependent()) {
>>> >> > + NoexceptExpr = getSema().VerifyIntegerConstantExpression(
>>> >> > + NoexceptExpr.get(), nullptr,
>>> >> > + diag::err_noexcept_needs_constant_expression,
>>> >> > + /*AllowFold*/false);
>>> >> > + if (NoexceptExpr.isInvalid())
>>> >> > + return true;
>>> >> > + }
>>> >> > +
>>> >> > + if (ESI.NoexceptExpr != NoexceptExpr.get())
>>> >> > + Changed = true;
>>> >> > + ESI.NoexceptExpr = NoexceptExpr.get();
>>> >> > + }
>>> >> > +
>>> >> > + if (ESI.Type != EST_Dynamic)
>>> >> > + return false;
>>> >> > +
>>> >> > + // Instantiate a dynamic exception specification's type.
>>> >> > + for (QualType T : ESI.Exceptions) {
>>> >> > + if (const PackExpansionType *PackExpansion =
>>> >> > + T->getAs<PackExpansionType>()) {
>>> >> > + Changed = true;
>>> >> > +
>>> >> > + // We have a pack expansion. Instantiate it.
>>> >> > + SmallVector<UnexpandedParameterPack, 2> Unexpanded;
>>> >> > +
>>> >> > SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
>>> >> > + Unexpanded);
>>> >> > + assert(!Unexpanded.empty() && "Pack expansion without
>>> parameter
>>> >> > packs?");
>>> >> > +
>>> >> > + // Determine whether the set of unexpanded parameter packs
>>> can
>>> >> > and
>>> >> > + // should
>>> >> > + // be expanded.
>>> >> > + bool Expand = false;
>>> >> > + bool RetainExpansion = false;
>>> >> > + Optional<unsigned> NumExpansions =
>>> >> > PackExpansion->getNumExpansions();
>>> >> > + // FIXME: Track the location of the ellipsis (and track
>>> source
>>> >> > location
>>> >> > + // information for the types in the exception specification
>>> in
>>> >> > general).
>>> >> > + if (getDerived().TryExpandParameterPacks(
>>> >> > + Loc, SourceRange(), Unexpanded, Expand,
>>> >> > + RetainExpansion, NumExpansions))
>>> >> > + return true;
>>> >> > +
>>> >> > + if (!Expand) {
>>> >> > + // We can't expand this pack expansion into separate
>>> arguments
>>> >> > yet;
>>> >> > + // just substitute into the pattern and create a new pack
>>> >> > expansion
>>> >> > + // type.
>>> >> > + Sema::ArgumentPackSubstitutionIndexRAII
>>> SubstIndex(getSema(),
>>> >> > -1);
>>> >> > + QualType U =
>>> >> > getDerived().TransformType(PackExpansion->getPattern());
>>> >> > + if (U.isNull())
>>> >> > + return true;
>>> >> > +
>>> >> > + U = SemaRef.Context.getPackExpansionType(U, NumExpansions);
>>> >> > + Exceptions.push_back(U);
>>> >> > + continue;
>>> >> > + }
>>> >> > +
>>> >> > + // Substitute into the pack expansion pattern for each slice
>>> of
>>> >> > the
>>> >> > + // pack.
>>> >> > + for (unsigned ArgIdx = 0; ArgIdx != *NumExpansions;
>>> ++ArgIdx) {
>>> >> > + Sema::ArgumentPackSubstitutionIndexRAII
>>> SubstIndex(getSema(),
>>> >> > ArgIdx);
>>> >> > +
>>> >> > + QualType U =
>>> >> > getDerived().TransformType(PackExpansion->getPattern());
>>> >> > + if (U.isNull() || SemaRef.CheckSpecifiedExceptionType(U,
>>> Loc))
>>> >> > + return true;
>>> >> > +
>>> >> > + Exceptions.push_back(U);
>>> >> > + }
>>> >> > + } else {
>>> >> > + QualType U = getDerived().TransformType(T);
>>> >> > + if (U.isNull() || SemaRef.CheckSpecifiedExceptionType(U,
>>> Loc))
>>> >> > + return true;
>>> >> > + if (T != U)
>>> >> > + Changed = true;
>>> >> > +
>>> >> > + Exceptions.push_back(U);
>>> >> > + }
>>> >> > + }
>>> >> > +
>>> >> > + ESI.Exceptions = Exceptions;
>>> >> > + return false;
>>> >> > +}
>>> >> > +
>>> >> > +template<typename Derived>
>>> >> > QualType TreeTransform<Derived>::TransformFunctionNoProtoType(
>>> >> > TypeLocBuilder
>>> &TLB,
>>> >> >
>>> FunctionNoProtoTypeLoc
>>> >> > TL) {
>>> >> > @@ -9005,9 +9123,13 @@ TreeTransform<Derived>::TransformLambdaE
>>> >> > // transformed parameters.
>>> >> >
>>> >> > TypeLocBuilder NewCallOpTLBuilder;
>>> >> > - QualType NewCallOpType =
>>> >> > TransformFunctionProtoType(NewCallOpTLBuilder,
>>> >> > -
>>> OldCallOpFPTL,
>>> >> > - nullptr,
>>> 0);
>>> >> > + SmallVector<QualType, 4> ExceptionStorage;
>>> >> > + QualType NewCallOpType = TransformFunctionProtoType(
>>> >> > + NewCallOpTLBuilder, OldCallOpFPTL, nullptr, 0,
>>> >> > + [&](FunctionProtoType::ExceptionSpecInfo &ESI, bool
>>> &Changed) {
>>> >> > + return
>>> TransformExceptionSpec(OldCallOpFPTL.getBeginLoc(),
>>> >> > ESI,
>>> >> > + ExceptionStorage, Changed);
>>> >> > + });
>>> >> > NewCallOpTSI =
>>> >> > NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context,
>>> >> >
>>> NewCallOpType);
>>> >> > }
>>> >> >
>>> >> > Modified: cfe/trunk/test/CXX/except/except.spec/p1.cpp
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/except/except.spec/p1.cpp?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/test/CXX/except/except.spec/p1.cpp (original)
>>> >> > +++ cfe/trunk/test/CXX/except/except.spec/p1.cpp Thu Oct 16 18:00:46
>>> >> > 2014
>>> >> > @@ -77,5 +77,12 @@ namespace PR11084 {
>>> >> > static int f() noexcept(1/X) { return 10; } //
>>> >> > expected-error{{argument to noexcept specifier must be a constant
>>> >> > expression}} expected-note{{division by zero}}
>>> >> > };
>>> >> >
>>> >> > - void g() { A<0>::f(); } // expected-note{{in instantiation of
>>> >> > exception specification for 'f' requested here}}
>>> >> > + template<int X> void f() {
>>> >> > + int (*p)() noexcept(1/X); // expected-error{{argument to
>>> noexcept
>>> >> > specifier must be a constant expression}} expected-note{{division
>>> by zero}}
>>> >> > + };
>>> >> > +
>>> >> > + void g() {
>>> >> > + A<0>::f(); // expected-note{{in instantiation of exception
>>> >> > specification for 'f'}}
>>> >> > + f<0>(); // expected-note{{in instantiation of function template
>>> >> > specialization}}
>>> >> > + }
>>> >> > }
>>> >> >
>>> >> > Modified:
>>> >> > cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
>>> >> > (original)
>>> >> > +++
>>> cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp Thu
>>> >> > Oct 16 18:00:46 2014
>>> >> > @@ -58,6 +58,13 @@ namespace dr1330_example {
>>> >> > S().f<S>(); // ok
>>> >> > S().f<int>(); // expected-note {{instantiation of exception
>>> spec}}
>>> >> > }
>>> >> > +
>>> >> > + template<typename T>
>>> >> > + struct U {
>>> >> > + void f() noexcept(T::error);
>>> >> > + void (g)() noexcept(T::error);
>>> >> > + };
>>> >> > + U<int> uint; // ok
>>> >> > }
>>> >> >
>>> >> > namespace core_19754_example {
>>> >> > @@ -137,3 +144,37 @@ namespace PR12763 {
>>> >> > };
>>> >> > void X::g() {} // expected-note {{in instantiation of}}
>>> >> > }
>>> >> > +
>>> >> > +namespace Variadic {
>>> >> > + template<bool B> void check() { static_assert(B, ""); }
>>> >> > + template<bool B, bool B2, bool ...Bs> void check() {
>>> static_assert(B,
>>> >> > ""); check<B2, Bs...>(); }
>>> >> > +
>>> >> > + template<typename ...T> void consume(T...);
>>> >> > +
>>> >> > + template<typename ...T> void f(void (*...p)() throw (T)) {
>>> >> > + void (*q[])() = { p... };
>>> >> > + consume((p(),0)...);
>>> >> > + }
>>> >> > + template<bool ...B> void g(void (*...p)() noexcept (B)) {
>>> >> > + consume((p(),0)...);
>>> >> > + check<noexcept(p()) == B ...>();
>>> >> > + }
>>> >> > + template<typename ...T> void i() {
>>> >> > + consume([]() throw(T) {} ...);
>>> >> > + consume([]() noexcept(sizeof(T) == 4) {} ...);
>>> >> > + }
>>> >> > + template<bool ...B> void j() {
>>> >> > + consume([](void (*p)() noexcept(B)) {
>>> >> > + void (*q)() noexcept = p; // expected-error {{not superset of
>>> >> > source}}
>>> >> > + } ...);
>>> >> > + }
>>> >> > +
>>> >> > + void z() {
>>> >> > + f<int, char, double>(nullptr, nullptr, nullptr);
>>> >> > + g<true, false, true>(nullptr, nullptr, nullptr);
>>> >> > + i<int, long, short>();
>>> >> > + j<true, true>();
>>> >> > + j<true, false>(); // expected-note {{in instantiation of}}
>>> >> > + }
>>> >> > +
>>> >> > +}
>>> >> >
>>> >> > Modified: cfe/trunk/test/SemaTemplate/instantiate-exception-spec.cpp
>>> >> > URL:
>>> >> >
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-exception-spec.cpp?rev=219977&r1=219976&r2=219977&view=diff
>>> >> >
>>> >> >
>>> ==============================================================================
>>> >> > --- cfe/trunk/test/SemaTemplate/instantiate-exception-spec.cpp
>>> >> > (original)
>>> >> > +++ cfe/trunk/test/SemaTemplate/instantiate-exception-spec.cpp Thu
>>> Oct
>>> >> > 16 18:00:46 2014
>>> >> > @@ -1,5 +1,7 @@
>>> >> > -// RUN: %clang_cc1 -fsyntax-only -verify %s
>>> >> > +// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -verify %s
>>> -DERRORS
>>> >> > +// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -emit-llvm-only %s
>>> >> >
>>> >> > +#ifdef ERRORS
>>> >> > template<typename T> void f1(T*) throw(T); //
>>> >> > expected-error{{incomplete type 'Incomplete' is not allowed in
>>> exception
>>> >> > specification}}
>>> >> > struct Incomplete; // expected-note{{forward}}
>>> >> >
>>> >> > @@ -7,3 +9,20 @@ void test_f1(Incomplete *incomplete_p, i
>>> >> > f1(int_p);
>>> >> > f1(incomplete_p); // expected-note{{instantiation of}}
>>> >> > }
>>> >> > +#endif
>>> >> > +
>>> >> > +template<typename T> void f(void (*p)() throw(T)) {
>>> >> > +#ifdef ERRORS
>>> >> > + void (*q)() throw(char) = p; // expected-error {{target exception
>>> >> > spec}}
>>> >> > +
>>> >> > + extern void (*p2)() throw(T);
>>> >> > + void (*q2)() throw(char) = p2; // expected-error {{target
>>> exception
>>> >> > spec}}
>>> >> > +
>>> >> > + extern void (*p3)() throw(char);
>>> >> > + void (*q3)() throw(T) = p3; // expected-error {{target exception
>>> >> > spec}}
>>> >> > +
>>> >> > + void (*q4)() throw(T) = p2; // ok
>>> >> > +#endif
>>> >> > + p();
>>> >> > +}
>>> >> > +void g() { f<int>(0); } // expected-note {{instantiation of}}
>>> >> >
>>> >> >
>>> >> > _______________________________________________
>>> >> > cfe-commits mailing list
>>> >> > cfe-commits at cs.uiuc.edu
>>> >> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>> >
>>> >
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141111/678b546f/attachment.html>
More information about the cfe-commits
mailing list