diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-01-05 04:16:30 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-01-05 04:16:30 +0000 |
| commit | 9c5534ceb183e1d0bc0f8b940e30a5b78e3c0d84 (patch) | |
| tree | 6a9566562cb31426195e877f32d2bc21f6b166c9 /clang/lib | |
| parent | 707eab665517240f85b1dc887adf4fe573519682 (diff) | |
| download | bcm5719-llvm-9c5534ceb183e1d0bc0f8b940e30a5b78e3c0d84.tar.gz bcm5719-llvm-9c5534ceb183e1d0bc0f8b940e30a5b78e3c0d84.zip | |
Per [temp.deduct.call], do not deduce an array bound of 0 from an empty initializer list.
llvm-svn: 291075
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaTemplateDeduction.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 35f2de16828..6c90b5c2266 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -3219,6 +3219,9 @@ static Sema::TemplateDeductionResult DeduceFromInitializerList( // parameter type and the initializer element as its argument // // We've already removed references and cv-qualifiers here. + if (!ILE->getNumInits()) + return Sema::TDK_Success; + QualType ElTy; auto *ArrTy = S.Context.getAsArrayType(AdjustedParamType); if (ArrTy) @@ -3241,7 +3244,6 @@ static Sema::TemplateDeductionResult DeduceFromInitializerList( // in the P0[N] case, if N is a non-type template parameter, N is deduced // from the length of the initializer list. - // FIXME: We're not supposed to get here if N would be deduced as 0. if (auto *DependentArrTy = dyn_cast_or_null<DependentSizedArrayType>(ArrTy)) { // Determine the array bound is something we can deduce. if (NonTypeTemplateParmDecl *NTTP = |

