https://llvm.org/bugs/show_bug.cgi?id=31742

            Bug ID: 31742
           Summary: Empty list initializer in dynamically-sized array
                    operator new fails pedantic checks
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangb...@nondot.org
          Reporter: cyg...@michiru.ru
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk
    Classification: Unclassified

Trunk clang seems to treat empty list initializer in array operator new with a
non-constant array length as array of zero size at some point, which is usually
not visible, but fails with -pedantic-errors:

$ cat dynamic-new-value-init.cpp 

void f(int n)
{
    new int[n]{};
}

$ clang++ -std=c++11 -fsyntax-only -pedantic-errors dynamic-new-value-init.cpp 

dynamic-new-value-init.cpp:3:15: error: zero size arrays are an extension
[-Werror,-Wzero-length-array]
    new int[n]{};
              ^
1 error generated.

clang 3.9.[01] compiles this fine.
This problem is caused by r283406 "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."

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to