<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Oct 17, 2014 at 6:08 AM, 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">Excuse me, reverted in r220038.<br>
<br>
With lit --vg,<br></blockquote><div><br></div><div>This failure does not reproduce for me. What is your host compiler? It looks like it might be miscompiling implicit lambda-captures of 'this'. (Or it could be a bug in the code, but no other builder complained and the code looks right to me...)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
******************** 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></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">==9619==    by 0x389B957: clang::TreeTransform<(anonymous<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>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<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>
namespace)::TemplateInstantiator>::TransformFunctionProtoType<clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,<br>
bool&)#1}>(clang::TypeLocBuilder&, clang::FunctionProtoTypeLoc,<br>
clang::CXXRecordDecl*, unsigned int, clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,<br>
bool&)#1}) (TreeTransform.h:4620)<br>
==9619==    by 0x38A0A3B: clang::QualType (anonymous<br>
namespace)::TemplateInstantiator::TransformFunctionProtoType<clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,<br>
bool&)#1}>(clang::TypeLocBuilder&, clang::FunctionProtoTypeLoc,<br>
clang::CXXRecordDecl*, unsigned int, clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,<br>
bool&)#1}) (SemaTemplateInstantiate.cpp:1345)<br>
==9619==    by 0x3897105: clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc) (TreeTransform.h:4566)<br>
==9619==    by 0x388F18E: (anonymous<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>
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>
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>
/home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:423:0<br>
#1 0x223c8e5 PrintStackTraceSignalHandler(void*)<br>
/home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:481:0<br>
#2 0x223b42e SignalHandler(int)<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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:137:0<br>
#5 0x389b958 clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformExceptionSpec(clang::SourceLocation,<br>
clang::FunctionProtoType::ExceptionSpecInfo&,<br>
llvm::SmallVectorImpl<clang::QualType>&, bool&)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4656:0<br>
#6 0x3897057 _ZZN5clang13TreeTransformIN12_GLOBAL__N_120TemplateInstantiatorEE26TransformFunctionProtoTypeERNS_14TypeLocBuilderENS_20FunctionProtoTypeLocEENKUlRNS_17FunctionProtoType17ExceptionSpecInfoERbE_clES9_SA_<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4566:0<br>
#7 0x38b90c0 _ZN5clang13TreeTransformIN12_GLOBAL__N_120TemplateInstantiatorEE26TransformFunctionProtoTypeIZNS3_26TransformFunctionProtoTypeERNS_14TypeLocBuilderENS_20FunctionProtoTypeLocEEUlRNS_17FunctionProtoType17ExceptionSpecInfoERbE_EENS_8QualTypeES6_S7_PNS_13CXXRecordDeclEjT_<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4620:0<br>
#8 0x38a0a3c _ZN12_GLOBAL__N_120TemplateInstantiator26TransformFunctionProtoTypeIZN5clang13TreeTransformIS0_E26TransformFunctionProtoTypeERNS2_14TypeLocBuilderENS2_20FunctionProtoTypeLocEEUlRNS2_17FunctionProtoType17ExceptionSpecInfoERbE_EENS2_8QualTypeES6_S7_PNS2_13CXXRecordDeclEjT_<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1345:0<br>
#9 0x3897106 clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4566:0<br>
#10 0x388f18f (anonymous<br>
namespace)::TemplateInstantiator::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)<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>
/home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:79:0<br>
#12 0x38aeed4 clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformParenType(clang::TypeLocBuilder&,<br>
clang::ParenTypeLoc)<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>
/home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:82:0<br>
#14 0x38acde6 clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformPointerType(clang::TypeLocBuilder&,<br>
clang::PointerTypeLoc)<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>
/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>
/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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1496:0<br>
#18 0x38cd909 clang::TemplateDeclInstantiator::VisitVarDecl(clang::VarDecl*,<br>
bool) /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:464:0<br>
#19 0x38cd7f6 clang::TemplateDeclInstantiator::VisitVarDecl(clang::VarDecl*)<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>
/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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:2665:0<br>
#22 0x388f858 (anonymous<br>
namespace)::TemplateInstantiator::TransformDefinition(clang::SourceLocation,<br>
clang::Decl*) /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>
/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>
/home/tnakamura/fio/ninja/1/tools/clang/include/clang/AST/StmtNodes.inc:91:0<br>
#25 0x38bc776 clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*,<br>
bool) /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:5583:0<br>
#26 0x38b408a clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*)<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>
/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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:2627:0<br>
#29 0x38d93e1 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,<br>
clang::FunctionDecl*, bool, bool)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:3422:0<br>
#30 0x38dd047 clang::Sema::PerformPendingInstantiations(bool)<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 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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/FrontendAction.cpp:522:0<br>
#35 0x2431a00 clang::FrontendAction::Execute()<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/FrontendAction.cpp:427:0<br>
#36 0x23f9744 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:812:0<br>
#37 0x2546564 clang::ExecuteCompilerInvocation(clang::CompilerInstance*)<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*) /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>
namespace)::TemplateInstantiator>::TransformExceptionSpec(clang::SourceLocation,<br>
clang::FunctionProtoType::ExceptionSpecInfo&,<br>
llvm::SmallVectorImpl<clang::QualType>&, bool&) (TreeTransform.h:4656)<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>
/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>
/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>
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>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<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>
namespace)::TemplateInstantiator>::TransformFunctionProtoType<clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,<br>
bool&)#1}>(clang::TypeLocBuilder&, clang::FunctionProtoTypeLoc,<br>
clang::CXXRecordDecl*, unsigned int, clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,<br>
bool&)#1}) (TreeTransform.h:4620)<br>
==9810==    by 0x38A0A3B: clang::QualType (anonymous<br>
namespace)::TemplateInstantiator::TransformFunctionProtoType<clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,<br>
bool&)#1}>(clang::TypeLocBuilder&, clang::FunctionProtoTypeLoc,<br>
clang::CXXRecordDecl*, unsigned int, clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,<br>
bool&)#1}) (SemaTemplateInstantiate.cpp:1345)<br>
==9810==    by 0x3897105: clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc) (TreeTransform.h:4566)<br>
==9810==    by 0x388F18E: (anonymous<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>
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>
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>
/home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:423:0<br>
#1 0x223c8e5 PrintStackTraceSignalHandler(void*)<br>
/home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:481:0<br>
#2 0x223b42e SignalHandler(int)<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>
/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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:3644:0<br>
#6 0x389bfad clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformExceptionSpec(clang::SourceLocation,<br>
clang::FunctionProtoType::ExceptionSpecInfo&,<br>
llvm::SmallVectorImpl<clang::QualType>&, bool&)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4734:0<br>
#7 0x3897057 _ZZN5clang13TreeTransformIN12_GLOBAL__N_120TemplateInstantiatorEE26TransformFunctionProtoTypeERNS_14TypeLocBuilderENS_20FunctionProtoTypeLocEENKUlRNS_17FunctionProtoType17ExceptionSpecInfoERbE_clES9_SA_<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4566:0<br>
#8 0x38b90c0 _ZN5clang13TreeTransformIN12_GLOBAL__N_120TemplateInstantiatorEE26TransformFunctionProtoTypeIZNS3_26TransformFunctionProtoTypeERNS_14TypeLocBuilderENS_20FunctionProtoTypeLocEEUlRNS_17FunctionProtoType17ExceptionSpecInfoERbE_EENS_8QualTypeES6_S7_PNS_13CXXRecordDeclEjT_<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4620:0<br>
#9 0x38a0a3c _ZN12_GLOBAL__N_120TemplateInstantiator26TransformFunctionProtoTypeIZN5clang13TreeTransformIS0_E26TransformFunctionProtoTypeERNS2_14TypeLocBuilderENS2_20FunctionProtoTypeLocEEUlRNS2_17FunctionProtoType17ExceptionSpecInfoERbE_EENS2_8QualTypeES6_S7_PNS2_13CXXRecordDeclEjT_<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1345:0<br>
#10 0x3897106 clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4566:0<br>
#11 0x388f18f (anonymous<br>
namespace)::TemplateInstantiator::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)<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>
/home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:79:0<br>
#13 0x38aeed4 clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformParenType(clang::TypeLocBuilder&,<br>
clang::ParenTypeLoc)<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>
/home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:82:0<br>
#15 0x38acde6 clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformPointerType(clang::TypeLocBuilder&,<br>
clang::PointerTypeLoc)<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>
/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>
/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>
/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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1680:0<br>
#20 0x38912db (anonymous<br>
namespace)::TemplateInstantiator::TransformFunctionTypeParam(clang::ParmVarDecl*,<br>
int, llvm::Optional<unsigned int>, bool)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1354:0<br>
#21 0x389c89b clang::TreeTransform<(anonymous<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>
/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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1751:0<br>
#23 0x385483a 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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:2632:0<br>
#24 0x3856c44 clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,<br>
clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>,<br>
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:3337:0<br>
#25 0x374461b clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*,<br>
clang::DeclAccessPair, clang::TemplateArgumentListInfo*,<br>
llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool)<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) /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaOverload.cpp:10353:0<br>
#27 0x37541d6 clang::Sema::AddOverloadedCallCandidates(clang::UnresolvedLookupExpr*,<br>
llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool)<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>*) /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>
/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 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,<br>
true>) /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>
/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 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 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 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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseStmt.cpp:1857:0<br>
#41 0x31f6f78 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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseDecl.cpp:1599:0<br>
#43 0x31f61c8 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 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 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 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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/FrontendAction.cpp:522:0<br>
#49 0x2431a00 clang::FrontendAction::Execute()<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/FrontendAction.cpp:427:0<br>
#50 0x23f9744 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:812:0<br>
#51 0x2546564 clang::ExecuteCompilerInvocation(clang::CompilerInstance*)<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*) /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>
/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>
/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>
/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 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>
/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>
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>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<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>
namespace)::TemplateInstantiator>::TransformFunctionProtoType<clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,<br>
bool&)#1}>(clang::TypeLocBuilder&, clang::FunctionProtoTypeLoc,<br>
clang::CXXRecordDecl*, unsigned int, clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,<br>
bool&)#1}) (TreeTransform.h:4620)<br>
==9809==    by 0x38A0A3B: clang::QualType (anonymous<br>
namespace)::TemplateInstantiator::TransformFunctionProtoType<clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,<br>
bool&)#1}>(clang::TypeLocBuilder&, clang::FunctionProtoTypeLoc,<br>
clang::CXXRecordDecl*, unsigned int, clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)::{lambda(clang::FunctionProtoType::ExceptionSpecInfo&,<br>
bool&)#1}) (SemaTemplateInstantiate.cpp:1345)<br>
==9809==    by 0x3897105: clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc) (TreeTransform.h:4566)<br>
==9809==    by 0x388F18E: (anonymous<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>
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>
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>
/home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:423:0<br>
#1 0x223c8e5 PrintStackTraceSignalHandler(void*)<br>
/home/tnakamura/fio/ninja/llvm-project/llvm/lib/Support/Unix/Signals.inc:481:0<br>
#2 0x223b42e SignalHandler(int)<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>
/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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:3644:0<br>
#6 0x389bfad clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformExceptionSpec(clang::SourceLocation,<br>
clang::FunctionProtoType::ExceptionSpecInfo&,<br>
llvm::SmallVectorImpl<clang::QualType>&, bool&)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4734:0<br>
#7 0x3897057 _ZZN5clang13TreeTransformIN12_GLOBAL__N_120TemplateInstantiatorEE26TransformFunctionProtoTypeERNS_14TypeLocBuilderENS_20FunctionProtoTypeLocEENKUlRNS_17FunctionProtoType17ExceptionSpecInfoERbE_clES9_SA_<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4566:0<br>
#8 0x38b90c0 _ZN5clang13TreeTransformIN12_GLOBAL__N_120TemplateInstantiatorEE26TransformFunctionProtoTypeIZNS3_26TransformFunctionProtoTypeERNS_14TypeLocBuilderENS_20FunctionProtoTypeLocEEUlRNS_17FunctionProtoType17ExceptionSpecInfoERbE_EENS_8QualTypeES6_S7_PNS_13CXXRecordDeclEjT_<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4620:0<br>
#9 0x38a0a3c _ZN12_GLOBAL__N_120TemplateInstantiator26TransformFunctionProtoTypeIZN5clang13TreeTransformIS0_E26TransformFunctionProtoTypeERNS2_14TypeLocBuilderENS2_20FunctionProtoTypeLocEEUlRNS2_17FunctionProtoType17ExceptionSpecInfoERbE_EENS2_8QualTypeES6_S7_PNS2_13CXXRecordDeclEjT_<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1345:0<br>
#10 0x3897106 clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/TreeTransform.h:4566:0<br>
#11 0x388f18f (anonymous<br>
namespace)::TemplateInstantiator::TransformFunctionProtoType(clang::TypeLocBuilder&,<br>
clang::FunctionProtoTypeLoc)<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>
/home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:79:0<br>
#13 0x38aeed4 clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformParenType(clang::TypeLocBuilder&,<br>
clang::ParenTypeLoc)<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>
/home/tnakamura/fio/ninja/llvm-project/clang/include/clang/AST/TypeNodes.def:82:0<br>
#15 0x38acde6 clang::TreeTransform<(anonymous<br>
namespace)::TemplateInstantiator>::TransformPointerType(clang::TypeLocBuilder&,<br>
clang::PointerTypeLoc)<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>
/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>
/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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1658:0<br>
#19 0x38912db (anonymous<br>
namespace)::TemplateInstantiator::TransformFunctionTypeParam(clang::ParmVarDecl*,<br>
int, llvm::Optional<unsigned int>, bool)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1354:0<br>
#20 0x389c568 clang::TreeTransform<(anonymous<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>
/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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:1751:0<br>
#22 0x385483a 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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:2632:0<br>
#23 0x3856c44 clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,<br>
clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>,<br>
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:3337:0<br>
#24 0x374461b clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*,<br>
clang::DeclAccessPair, clang::TemplateArgumentListInfo*,<br>
llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool)<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) /home/tnakamura/fio/ninja/llvm-project/clang/lib/Sema/SemaOverload.cpp:10353:0<br>
#26 0x37541d6 clang::Sema::AddOverloadedCallCandidates(clang::UnresolvedLookupExpr*,<br>
llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool)<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>*) /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>
/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 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,<br>
true>) /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>
/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 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 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 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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseStmt.cpp:1857:0<br>
#40 0x31f6f78 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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseDecl.cpp:1599:0<br>
#42 0x31f61c8 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 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 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 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>
/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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:189:0<br>
#47 0x320677a clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*,<br>
32u>&, unsigned int, clang::SourceLocation&,<br>
clang::Parser::ParsedAttributesWithRange&)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Parse/ParseDecl.cpp:1340:0<br>
#48 0x31f55db 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 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>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/FrontendAction.cpp:522:0<br>
#52 0x2431a00 clang::FrontendAction::Execute()<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/FrontendAction.cpp:427:0<br>
#53 0x23f9744 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)<br>
/home/tnakamura/fio/ninja/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:812:0<br>
#54 0x2546564 clang::ExecuteCompilerInvocation(clang::CompilerInstance*)<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*) /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>
/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>
/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>
/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). 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 (other<br>
> than the type of a function declaration). We previously didn't instantiate<br>
> these at all! This also covers the pathological case where the only mention of<br>
> a parameter pack is within the exception specification; this gives us a second<br>
> way (other than alias templates) to reach the horrible state where a 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: <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>
> --- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original)<br>
> +++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h Thu Oct 16 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 = 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 = 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: <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>
> --- 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 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 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 kind");<br>
>      CastExprBits.Kind = kind;<br>
>      setBasePathSize(BasePathSize);<br>
><br>
> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h<br>
> URL: <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>
> --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)<br>
> +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Thu Oct 16 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 = 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 = 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: <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>
> --- 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 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: <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>
> --- 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> DynamicExceptions,<br>
>                                     ArrayRef<SourceRange> 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 *Proto,<br>
> +                          const MultiLevelTemplateArgumentList &Args);<br>
>    ParmVarDecl *SubstParmVarDecl(ParmVarDecl *D,<br>
>                              const MultiLevelTemplateArgumentList &TemplateArgs,<br>
>                                  int indexAdjustment,<br>
><br>
> Modified: cfe/trunk/lib/AST/Type.cpp<br>
> URL: <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>
> --- 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 (epi.ExceptionSpec.NoexceptExpr->isInstantiationDependent())<br>
> +      if (epi.ExceptionSpec.NoexceptExpr->isValueDependent() ||<br>
> +          epi.ExceptionSpec.NoexceptExpr->isInstantiationDependent())<br>
>          setInstantiationDependent();<br>
> +<br>
> +      if (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 dependent,<br>
> +    // because we don't know whether the pattern is in the exception 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: <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>
> --- 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> DynamicExceptions,<br>
> -                                  ArrayRef<SourceRange> DynamicExceptionRanges,<br>
> -                                  Expr *NoexceptExpr,<br>
> -                                  SmallVectorImpl<QualType> &Exceptions,<br>
> -                                  FunctionProtoType::ExceptionSpecInfo &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>
> -        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(), 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 boolean");<br>
> -      if (NoexceptExpr && 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: <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>
> --- 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 parameters<br>
>  /// of parameter function pointers recursively, as no sane programmer 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, 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>
>    // First we check for applicability.<br>
>    // Target type must be a function, function pointer or function 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 = 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 compatibility.<br>
>    // This means that the source of the conversion can only throw a subset of<br>
>    // the exceptions of the target, and any exception specs on arguments or<br>
>    // return types must be equivalent.<br>
> +  //<br>
> +  // FIXME: If there is a nested dependent exception specification, we 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 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: <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>
> --- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)<br>
> +++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Thu Oct 16 18:00:46 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 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 TemplateInstantiator::TransformFunctionProtoType(TypeLocBuilder &TLB,<br>
> -                                                      FunctionProtoTypeLoc TL) {<br>
> -  // We need a local instantiation scope for this function prototype.<br>
> -  LocalInstantiationScope Scope(SemaRef, /*CombineWithOuterScope=*/true);<br>
> -  return inherited::TransformFunctionProtoType(TLB, TL);<br>
> -}<br>
> -<br>
> +template<typename Fn><br>
>  QualType 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, /*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 &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, ThisContext,<br>
> -                                                     ThisTypeQuals);<br>
> +  if (FunctionProtoTypeLoc Proto =<br>
> +          TL.IgnoreParens().getAs<FunctionProtoTypeLoc>()) {<br>
> +    // Instantiate the type, other than its exception specification. The<br>
> +    // exception specification is instantiated in InitFunctionInstantiation<br>
> +    // once we've built the FunctionDecl.<br>
> +    // FIXME: Set the exception specification to EST_Uninstantiated 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 FunctionProtoType *Proto,<br>
> +                              const MultiLevelTemplateArgumentList &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 &TemplateArgs,<br>
>                                      int indexAdjustment,<br>
><br>
> Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp<br>
> URL: <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>
> --- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)<br>
> +++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Thu Oct 16 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 *Function,<br>
> +static bool addInstantiatedParametersToScope(Sema &S, FunctionDecl *Function,<br>
>                                               const FunctionDecl *PatternDecl,<br>
>                                               LocalInstantiationScope &Scope,<br>
>                             const MultiLevelTemplateArgumentList &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 the type<br>
>        // in the pattern. They can differ in top-level cv-qualifiers, and we want<br>
>        // the pattern's type here. If the type is dependent, they can't differ,<br>
> -      // per core issue 1668.<br>
> +      // per core issue 1668. Substitute into the type from the pattern, in case<br>
> +      // it's instantiation-dependent.<br>
>        // FIXME: Updating the type to work around this is at best 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(), TemplateArgs);<br>
>      assert(NumArgumentsInExpansion &&<br>
>             "should only be called when all template arguments are known");<br>
> +    QualType PatternType =<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 &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 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>
> -      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 = 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 yet;<br>
> -        // just substitute into the pattern and create a new pack expansion<br>
> -        // type.<br>
> -        Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, -1);<br>
> -        QualType T = SemaRef.SubstType(PackExpansion->getPattern(),<br>
> -                                       TemplateArgs,<br>
> -                                     New->getLocation(), 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, ArgIdx);<br>
> -<br>
> -        QualType T = SemaRef.SubstType(PackExpansion->getPattern(),<br>
> -                                       TemplateArgs,<br>
> -                                     New->getLocation(), 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>
> -                                                 Sema::ConstantEvaluated);<br>
> -    ExprResult E = SemaRef.SubstExpr(OldNoexceptExpr, TemplateArgs);<br>
> -    if (E.isUsable())<br>
> -      E = SemaRef.CheckBooleanCondition(E.get(), 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 PointOfInstantiation,<br>
> @@ -3243,11 +3141,14 @@ void Sema::InstantiateExceptionSpec(Sour<br>
>      getTemplateInstantiationArgs(Decl, nullptr, /*RelativeToPrimary*/true);<br>
><br>
>    FunctionDecl *Template = Proto->getExceptionSpecTemplate();<br>
> -  addInstantiatedParametersToScope(*this, Decl, Template, Scope, TemplateArgs);<br>
> +  if (addInstantiatedParametersToScope(*this, Decl, Template, Scope,<br>
> +                                       TemplateArgs)) {<br>
> +    UpdateExceptionSpec(Decl, EST_None);<br>
> +    return;<br>
> +  }<br>
><br>
> -  ::InstantiateExceptionSpec(*this, Decl,<br>
> -                             Template->getType()->castAs<FunctionProtoType>(),<br>
> -                             TemplateArgs);<br>
> +  SubstExceptionSpec(Decl, 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, PatternDecl);<br>
><br>
> -    addInstantiatedParametersToScope(*this, Function, PatternDecl, Scope,<br>
> -                                     TemplateArgs);<br>
> +    if (addInstantiatedParametersToScope(*this, Function, PatternDecl, 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: <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>
> --- 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: <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>
> --- 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 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 &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 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, ExceptionStorage,<br>
> +                                      Changed);<br>
> +      });<br>
>  }<br>
><br>
> -template<typename Derived><br>
> -QualType<br>
> -TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB,<br>
> -                                                   FunctionProtoTypeLoc TL,<br>
> -                                                   CXXRecordDecl *ThisContext,<br>
> -                                                   unsigned ThisTypeQuals) {<br>
> +template<typename Derived> template<typename Fn><br>
> +QualType TreeTransform<Derived>::TransformFunctionProtoType(<br>
> +    TypeLocBuilder &TLB, FunctionProtoTypeLoc TL, CXXRecordDecl *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 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>
>        T->getNumParams() != ParamTypes.size() ||<br>
>        !std::equal(T->param_type_begin(), T->param_type_end(),<br>
> -                  ParamTypes.begin())) {<br>
> -    Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes,<br>
> -                                                   T->getExtProtoInfo());<br>
> +                  ParamTypes.begin()) || EPIChanged) {<br>
> +    Result = getDerived().RebuildFunctionProtoType(ResultType, 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 != EST_Unevaluated);<br>
> +<br>
> +  // Instantiate a dynamic noexcept expression, if any.<br>
> +  if (ESI.Type == EST_ComputedNoexcept) {<br>
> +    EnterExpressionEvaluationContext Unevaluated(getSema(),<br>
> +                                                 Sema::ConstantEvaluated);<br>
> +    ExprResult NoexceptExpr = 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>
> +      SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),<br>
> +                                              Unexpanded);<br>
> +      assert(!Unexpanded.empty() && "Pack expansion without parameter packs?");<br>
> +<br>
> +      // Determine whether the set of unexpanded parameter packs can and<br>
> +      // should<br>
> +      // be expanded.<br>
> +      bool Expand = false;<br>
> +      bool RetainExpansion = false;<br>
> +      Optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();<br>
> +      // FIXME: Track the location of the ellipsis (and track source location<br>
> +      // information for the types in the exception specification in 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 yet;<br>
> +        // just substitute into the pattern and create a new pack expansion<br>
> +        // type.<br>
> +        Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);<br>
> +        QualType U = 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 the<br>
> +      // pack.<br>
> +      for (unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {<br>
> +        Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), ArgIdx);<br>
> +<br>
> +        QualType U = 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 TL) {<br>
> @@ -9005,9 +9123,13 @@ TreeTransform<Derived>::TransformLambdaE<br>
>      // transformed parameters.<br>
><br>
>      TypeLocBuilder NewCallOpTLBuilder;<br>
> -    QualType NewCallOpType = 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(), ESI,<br>
> +                                        ExceptionStorage, Changed);<br>
> +        });<br>
>      NewCallOpTSI = NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context,<br>
>                                                          NewCallOpType);<br>
>    }<br>
><br>
> Modified: cfe/trunk/test/CXX/except/except.spec/p1.cpp<br>
> URL: <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>
> --- 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 2014<br>
> @@ -77,5 +77,12 @@ namespace PR11084 {<br>
>      static int f() noexcept(1/X) { return 10; }  // expected-error{{argument to noexcept specifier must be a constant expression}} expected-note{{division by zero}}<br>
>    };<br>
><br>
> -  void g() { A<0>::f(); } // expected-note{{in instantiation of exception specification for 'f' requested here}}<br>
> +  template<int X> void f() {<br>
> +    int (*p)() noexcept(1/X); // expected-error{{argument to noexcept 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 specification for 'f'}}<br>
> +    f<0>(); // expected-note{{in instantiation of function template specialization}}<br>
> +  }<br>
>  }<br>
><br>
> Modified: cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp<br>
> URL: <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>
> --- cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp (original)<br>
> +++ cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp Thu 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, ""); 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 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: <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>
> --- cfe/trunk/test/SemaTemplate/instantiate-exception-spec.cpp (original)<br>
> +++ cfe/trunk/test/SemaTemplate/instantiate-exception-spec.cpp Thu Oct 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); // expected-error{{incomplete type 'Incomplete' is not allowed in exception 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 spec}}<br>
> +<br>
> +  extern void (*p2)() throw(T);<br>
> +  void (*q2)() throw(char) = p2; // expected-error {{target exception spec}}<br>
> +<br>
> +  extern void (*p3)() throw(char);<br>
> +  void (*q3)() throw(T) = p3; // expected-error {{target exception 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>
</blockquote></div><br></div></div>