Skip to content
  • Richard Smith's avatar
    PR22924, PR22845, some of CWG1464: When checking the initializer for an array · 76767b5a
    Richard Smith authored
    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
    76767b5a