public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96980] New: unimplemented of variably-modified type
@ 2020-09-08 12:51 tangyixuan at mail dot dlut.edu.cn
  2020-09-08 14:49 ` [Bug c++/96980] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: tangyixuan at mail dot dlut.edu.cn @ 2020-09-08 12:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96980
           Summary: unimplemented of variably-modified type
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tangyixuan at mail dot dlut.edu.cn
  Target Milestone: ---

Hi, the following code is not compiled by g++ but is compiled by clang.

$ cat s.cpp

int main (){
        int a=2, b=3;
        int A[a][b];
        auto B =[&](){
                int c=1, d=2;
                int C = A[c][d];
        };
        B();
}


$ clang++ -c s.cpp
success.

$ g++ -c s.cpp
s.cpp: In lambda function:
s.cpp:6:25: sorry, unimplemented: capture of variably-modified type ‘int
[a][b]’ that is not an N3639 array of runtime bound
    6 |                 int C = A[c][d];
      |                         ^
s.cpp:6:25: note: because the array element type ‘int [b]’ has variable size

$ g++ -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-20200823/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/gcc-20200823/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-11-20200823/configure --prefix=/usr/local/gcc-20200823
--enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200823 (experimental) (GCC)

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

* [Bug c++/96980] unimplemented of variably-modified type
  2020-09-08 12:51 [Bug c++/96980] New: unimplemented of variably-modified type tangyixuan at mail dot dlut.edu.cn
@ 2020-09-08 14:49 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2020-09-08 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is not valid C++, that's why GCC doesn't accept it.

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

end of thread, other threads:[~2020-09-08 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 12:51 [Bug c++/96980] New: unimplemented of variably-modified type tangyixuan at mail dot dlut.edu.cn
2020-09-08 14:49 ` [Bug c++/96980] " redi 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).