[PATCH] D99165: [clang] Treat variable-length array of incomplete element type as incomplete type.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 24 06:15:47 PDT 2021
hokein added inline comments.
================
Comment at: clang/lib/AST/Type.cpp:2234
// (C++ [dcl.array]p1).
- // We don't handle variable arrays (they're not allowed in C++) or
- // dependent-sized arrays (dependent types are never treated as incomplete).
----------------
sammccall wrote:
> hokein wrote:
> > This comment is pretty old, and was added in 2dfdb820ca550f75769f6850bc27f825f1dce4f7 in 2009. I don't think this is correct anymore, variable-length array is allowed in C++, and from http://eel.is/c++draft/basic.types.general#5,
> >
> > > an array of unknown bound or of incomplete element type, is an incompletely-defined object type.36 Incompletely-defined object types and cv void are incomplete types
> >
> > This comment is pretty old, and was added in 2dfdb820ca550f75769f6850bc27f825f1dce4f7 in 2009. I don't think this is correct anymore
>
> Agree, VLA in C++ were supported in clang in e7545b33ff79 (5 years ago)
>
> > variable-length array is allowed in C++
>
> Not by the standard! It's an extension, copied from gcc.
>
> > an array of unknown bound or of incomplete element type
>
> Yeah, it makes sense to treat VLA like array here.
> (I was confused, but "unknown bound" doesn't refer to VLAs, that's rather `extern int x[];` which is `IncompleteArray`)
> Not by the standard! It's an extension, copied from gcc.
oh, right. VLA is allowed by C99 standard, but not in C++ standard, weird..
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99165/new/
https://reviews.llvm.org/D99165
More information about the cfe-commits
mailing list