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