PR22924, PR22845, some of CWG1464: When checking the initializer for an array
new expression, distinguish between the case of a constant and non-constant initializer. In the former case, if the bound is erroneous (too many initializer elements, bound is negative, or allocated size overflows), reject, and take the bound into account when determining whether we need to default-construct any elements. In the remanining cases, move the logic to check for default-constructibility of trailing elements into the initialization code rather than inventing a bogus array bound, to cope with cases where the number of initialized elements is not the same as the number of initializer list elements (this can happen due to string literal initialization or brace elision). This also fixes rejects-valid and crash-on-valid errors when initializing a new'd array of character type from a braced string literal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283406 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Basic/DiagnosticGroups.td 0 additions, 1 deletioninclude/clang/Basic/DiagnosticGroups.td
- include/clang/Basic/DiagnosticSemaKinds.td 4 additions, 8 deletionsinclude/clang/Basic/DiagnosticSemaKinds.td
- include/clang/Sema/Initialization.h 6 additions, 0 deletionsinclude/clang/Sema/Initialization.h
- lib/CodeGen/CGExprCXX.cpp 66 additions, 27 deletionslib/CodeGen/CGExprCXX.cpp
- lib/Sema/SemaExprCXX.cpp 42 additions, 48 deletionslib/Sema/SemaExprCXX.cpp
- lib/Sema/SemaInit.cpp 18 additions, 6 deletionslib/Sema/SemaInit.cpp
- test/Analysis/cfg.cpp 2 additions, 2 deletionstest/Analysis/cfg.cpp
- test/CodeGenCXX/new-array-init.cpp 77 additions, 7 deletionstest/CodeGenCXX/new-array-init.cpp
- test/SemaCXX/new-delete-cxx0x.cpp 39 additions, 9 deletionstest/SemaCXX/new-delete-cxx0x.cpp
Loading
Please register or sign in to comment