https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101937

            Bug ID: 101937
           Summary: error: variable-sized object may not be initialized
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: unlvsur at live dot com
  Target Milestone: ---

const char spacing[ctx._M_indent + 1] = "    ";

VLA does not initialize variable. GCC does not detect this. However when I use
clang --target=wasm32-wasi, clang complains it.

https://github.com/gcc-mirror/gcc/blob/e660441f94f2ca2ca1bd63c922c6a43737c2259e/libstdc%2B%2B-v3/src/c%2B%2B11/debug.cc#L628

../../../../gcc/libstdc++-v3/src/c++11/debug.cc:628:17: error: variable-sized
object may not be initialized
            const char spacing[ctx._M_indent + 1] = "    ";
                       ^                            ~~~~~~

Reply via email to