[Bug c++/78939] New: <tuple> interferes with structured binding from struct

gccbugbjorn at fahller dot se gcc-bugzilla@gcc.gnu.org
Wed Dec 28 09:52:00 GMT 2016


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

            Bug ID: 78939
           Summary: <tuple> interferes with structured binding from struct
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gccbugbjorn at fahller dot se
  Target Milestone: ---

Created attachment 40423
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40423&action=edit
preprocessed source

Using a home build from rvn rev 243954, I get the following error from the
attached program.

bjorn@pteranodon /tmp $ LANG=C /opt/gcc-trunk/bin/g++ -std=c++1z t.cpp -v
-save-temps
Using built-in specs.
COLLECT_GCC=/opt/gcc-trunk/bin/g++
COLLECT_LTO_WRAPPER=/opt/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../src/gcc-trunk/configure --prefix=/opt/gcc-trunk
--with-languages=c,cpp : (reconfigured) ../src/gcc-trunk/configure
--prefix=/opt/gcc-trunk --with-languages=c,cpp : (reconfigured)
../src/gcc-trunk/configure --prefix=/opt/gcc-trunk --with-languages=c,cpp
--enable-languages=c,c++,fortran,lto,objc --no-create --no-recursion :
(reconfigured) ../src/gcc-trunk/configure --prefix=/opt/gcc-trunk
--with-languages=c,cpp --enable-languages=c,c++,fortran,lto,objc --no-create
--no-recursion : (reconfigured) ../src/gcc-trunk/configure
--prefix=/opt/gcc-trunk --with-languages=c,cpp
--enable-languages=c,c++,fortran,lto,objc --no-create --no-recursion :
(reconfigured) ../src/gcc-trunk/configure --prefix=/opt/gcc-trunk
--with-languages=c,cpp --enable-languages=c,c++,fortran,lto,objc --no-create
--no-recursion
Thread model: posix
gcc version 7.0.0 20161228 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-std=c++1z' '-v' '-save-temps' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /opt/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/cc1plus -E -quiet -v
-D_GNU_SOURCE t.cpp -mtune=generic -march=x86-64 -std=c++1z -fpch-preprocess -o
t.ii
ignoring nonexistent directory
"/opt/gcc-trunk/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/gcc-trunk/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../include/c++/7.0.0

/opt/gcc-trunk/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../include/c++/7.0.0/x86_64-pc-linux-gnu

/opt/gcc-trunk/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../include/c++/7.0.0/backward
 /opt/gcc-trunk/lib/gcc/x86_64-pc-linux-gnu/7.0.0/include
 /usr/local/include
 /opt/gcc-trunk/include
 /opt/gcc-trunk/lib/gcc/x86_64-pc-linux-gnu/7.0.0/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-std=c++1z' '-v' '-save-temps' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /opt/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/cc1plus -fpreprocessed
t.ii -quiet -dumpbase t.cpp -mtune=generic -march=x86-64 -auxbase t -std=c++1z
-version -o t.s
GNU C++14 (GCC) version 7.0.0 20161228 (experimental) (x86_64-pc-linux-gnu)
        compiled by GNU C version 7.0.0 20161228 (experimental), GMP version
6.1.0, MPFR version 3.1.3-p4, MPC version 1.0.2, isl version 0.15
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++14 (GCC) version 7.0.0 20161228 (experimental) (x86_64-pc-linux-gnu)
        compiled by GNU C version 7.0.0 20161228 (experimental), GMP version
6.1.0, MPFR version 3.1.3-p4, MPC version 1.0.2, isl version 0.15
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 5b476c9dfff0e6f026bb8151315d0c94
t.cpp: In function 'int main()':
t.cpp:9:9: error: 'std::tuple_size<const S>::value' is not an integral constant
expression
   auto& [p] = s;


If <tuple> is not included, it compiles. It also compiles if the decomposition
declaration is changed from reference to value - "auto [p] = s;"


More information about the Gcc-bugs mailing list