public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114534] New: Feature request: extend VLA support in C++
@ 2024-03-30 18:45 nightstrike at gmail dot com
  2024-03-30 18:50 ` [Bug c++/114534] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: nightstrike at gmail dot com @ 2024-03-30 18:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114534
           Summary: Feature request: extend VLA support in C++
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nightstrike at gmail dot com
  Target Milestone: ---

See https://gcc.gnu.org/pipermail/gcc-help/2024-March/143369.html for
reference.

The documentation at https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html
states that VLAs are supported in C++ as an extension.

Compiling the following:

void f(int a, int b[a]);
void f() {
  int c[2];
  f(2, c);
}

with g++ -std=gnu++20 results in the error: "use of parameter outside function
body before ']' token".  The docs say nothing about partial support of VLA,
just that they can be used.

Where this is useful as an extension is in the somewhat reasonable case of
including a C header in a C++ program.  If that C header declares a function
using a C99 VLA, it would be awesome if g++ were to accept it in -std=gnu++
mode (and it would be fine if it were rejected in -std=c++ mode).  Consider a
situation where you cannot modify the header, and so have to use it as-is.

For comparison, clang added support for this feature in version 12.  It would
be advantageous to have feature parity given that it started as a GNU
extension.  Moreover, better interoperability with C is useful in its own
right.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/114534] Feature request: extend VLA support in C++
  2024-03-30 18:45 [Bug c++/114534] New: Feature request: extend VLA support in C++ nightstrike at gmail dot com
@ 2024-03-30 18:50 ` pinskia at gcc dot gnu.org
  2024-03-30 19:15 ` pinskia at gcc dot gnu.org
  2024-03-30 19:18 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-30 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/114534] Feature request: extend VLA support in C++
  2024-03-30 18:45 [Bug c++/114534] New: Feature request: extend VLA support in C++ nightstrike at gmail dot com
  2024-03-30 18:50 ` [Bug c++/114534] " pinskia at gcc dot gnu.org
@ 2024-03-30 19:15 ` pinskia at gcc dot gnu.org
  2024-03-30 19:18 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-30 19:15 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=51352

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this is a dup of bug 51352 really.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/114534] Feature request: extend VLA support in C++
  2024-03-30 18:45 [Bug c++/114534] New: Feature request: extend VLA support in C++ nightstrike at gmail dot com
  2024-03-30 18:50 ` [Bug c++/114534] " pinskia at gcc dot gnu.org
  2024-03-30 19:15 ` pinskia at gcc dot gnu.org
@ 2024-03-30 19:18 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-30 19:18 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=97820

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> I think this is a dup of bug 51352 really.

And/or PR 97820 too.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-30 19:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-30 18:45 [Bug c++/114534] New: Feature request: extend VLA support in C++ nightstrike at gmail dot com
2024-03-30 18:50 ` [Bug c++/114534] " pinskia at gcc dot gnu.org
2024-03-30 19:15 ` pinskia at gcc dot gnu.org
2024-03-30 19:18 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).