https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94457
Bug ID: 94457 Summary: using ~VariableName in trailing return type deduction does not compile Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: peter_foelsche at mentor dot com Target Milestone: --- Created attachment 48171 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48171&action=edit test source code using ~std::declval<T>() instead works fine -- use -D__WORKS__ -- use -std=c++11 g++ ~/test.cpp -std=c++11: /home/pfoelsch/test.cpp: In function 'int main(int, char**)': /home/pfoelsch/test.cpp:22:34: error: no match for call to '(bit_not) (test)' { const auto s = bit_not()(test()); ^ /home/pfoelsch/test.cpp:12:7: note: candidate: template<class T> decltype (~ _r) bit_not::operator()(const T&) const auto operator()(const T&_r) const -> decltype(~ _r) ^ /home/pfoelsch/test.cpp:12:7: note: template argument deduction/substitution failed: /home/pfoelsch/test.cpp: In substitution of 'template<class T> decltype (~ _r) bit_not::operator()(const T&) const [with T = test]': /home/pfoelsch/test.cpp:22:34: required from here /home/pfoelsch/test.cpp:12:7: error: '_r' was not declared in this scope orw-ams-ms7 /scratch/pfoelsch/SYMPHONY/linux_x86_64/release : g++ --version -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper g++ (GCC) 5.3.0 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Target: x86_64-unknown-linux-gnu Configured with: /local/tmp/gcc-5.3.0_binutils-2.31.1/src/gcc-5.3.0/configure --with-local-prefix=/u/ams --disable-nls --prefix=/local/tmp/gcc-5.3.0_binutils-2.31.1/distrib/x86_64/2.6.32-431.el6.x86_64 --enable-languages=c,c++,fortran --with-gnu-as --with-as=/local/tmp/gcc-5.3.0_binutils-2.31.1/distrib/x86_64/2.6.32-431.el6.x86_64/bin/as --with-gnu-ld --with-ld=/local/tmp/gcc-5.3.0_binutils-2.31.1/distrib/x86_64/2.6.32-431.el6.x86_64/bin/ld Thread model: posix gcc version 5.3.0 (GCC) COLLECT_GCC_OPTIONS='--version' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/cc1 -quiet -v -iprefix /wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/ help-dummy -quiet -dumpbase help-dummy -mtune=generic -march=x86-64 -auxbase help-dummy -version --version -o /tmp/cc0dabSv.s GNU C11 (GCC) version 5.3.0 (x86_64-unknown-linux-gnu) compiled by GNU C version 5.3.0, GMP version 6.1.0, MPFR version 3.1.3, MPC version 1.0.3 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 COLLECT_GCC_OPTIONS='--version' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../x86_64-unknown-linux-gnu/bin/as -v --64 --version -o /tmp/ccbi2PlA.o /tmp/cc0dabSv.s GNU assembler version 2.31.1 (x86_64-unknown-linux-gnu) using BFD version (GNU Binutils) 2.31.1 GNU assembler (GNU Binutils) 2.31.1 Copyright (C) 2018 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `x86_64-unknown-linux-gnu'. COMPILER_PATH=/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/:/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../libexec/gcc/:/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../x86_64-unknown-linux-gnu/bin/ LIBRARY_PATH=/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/:/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/:/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../x86_64-unknown-linux-gnu/lib/:/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='--version' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/collect2 -plugin /wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/liblto_plugin.so -plugin-opt=/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp/cc1Mt1PE.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 --version /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/crtbegin.o -L/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0 -L/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc -L/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../x86_64-unknown-linux-gnu/lib -L/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../.. /tmp/ccbi2PlA.o -lgcc_s -lgcc -lc -lgcc_s -lgcc /wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/crtend.o /usr/lib/../lib64/crtn.o collect2 version 5.3.0 /wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld -plugin /wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/liblto_plugin.so -plugin-opt=/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp/cc1Mt1PE.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 --version /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/crtbegin.o -L/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0 -L/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc -L/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../x86_64-unknown-linux-gnu/lib -L/wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../.. /tmp/ccbi2PlA.o -lgcc_s -lgcc -lc -lgcc_s -lgcc /wv/for_all/ams/free/GNU/devenv_g5/develop_v1.2/x86_64/2.6.32-431.el6.x86_64/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0/crtend.o /usr/lib/../lib64/crtn.o GNU ld (GNU Binutils) 2.31.1 Copyright (C) 2018 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty. orw-ams-ms7 /scratch/pfoelsch/SYMPHONY/linux_x86_64/release :