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

            Bug ID: 68113
           Summary: VLA+typeof+new -- confusing warning
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ch3root at openwall dot com
  Target Milestone: ---

Compilation of the program:

int main()
{
  int n = 1;
  int a[n];
  new __typeof__ a;

  return 0;
}

with just `g++ vla-typeof-new.cpp` outputs:

vla-typeof-new.cpp: In function ‘int main()’:
vla-typeof-new.cpp:5:18: warning: non-constant array new length must be
specified without parentheses around the type-id [-Wvla]
   new __typeof__ a;
                  ^

Perhaps the code is invalid but the warning is kinda confusing (there are no
parentheses here:-)

Reply via email to