[Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52595 Bug #: 52595 Summary: Incorrect parsing of commas in non-static data member initializers Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: jer...@jeremyms.com With this example: --- template struct A { static int foo(); }; template struct B { int var = A::foo(); }; --- Compiled with -std=gnu++11, g++ gives the following error: test.cpp:9:17: error: expected ';' at end of member declaration test.cpp:9:17: error: declaration of 'int B::N' test.cpp:7:20: error: shadows template parm 'int N' test.cpp:9:18: error: expected unqualified-id before '>' token test.cpp:9:15: error: wrong number of template arguments (1, should be 2) test.cpp:2:8: error: provided for 'template struct A' Surrounding the initializer in parentheses, i.e. int var = (A::foo()); fixes the error. This error also does not happen for static data members. It appears that g++ is not properly parsing the comma inside the template argument list. COLLECT_GCC=g++-4.7.0-pre COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.0-pre/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.7.0_pre/work/gcc-4.7.0-/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.0-pre --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0-pre/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.0-pre --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.0-pre/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.0-pre/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0-pre/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-lto --disable-nls --with-system-zlib --disable-werror --enable-secureplt --enable-multilib --with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.7.0-pre/python --enable-checking=release --disable-libgcj --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.7.0_pre' Thread model: posix gcc version 4.7.0-pre 20120314 (prerelease) commit fe9f13b8d6563daf45c0ed10da40ec2c05473a11 (Gentoo 4.7.0_pre)
[Bug c++/85977] New: Incorrect handling of array reference size deduction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85977 Bug ID: 85977 Summary: Incorrect handling of array reference size deduction Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jeremy at jeremyms dot com Target Milestone: --- This code should compile, but does not. template void foo(const long (&arr)[N]) {} void bar() { foo({1,2,3}); } See discussion here: https://groups.google.com/a/isocpp.org/forum/#!topic/std-discussion/FS5lNgf9_pQ
[Bug c++/91911] New: Strange interaction between CTAD and decltype
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91911 Bug ID: 91911 Summary: Strange interaction between CTAD and decltype Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jeremy at jeremyms dot com Target Milestone: --- See example program below. Works in clang and MSVC. Fails in GCC 7.1 through trunk. #include #include #include template struct span { using value_type = T; span(std::vector &x) {} }; template using SpanType = decltype(span(std::declval())); // Compilation succeeds if we change line below to #if 1 #if 0 template using ConstSpanType = span()))::value_type>; #else template using ConstSpanType = span::value_type>; #endif static_assert( std::is_same_v&>, span>); Error: source>: In substitution of 'template using ConstSpanType = span)(declval()))::value_type> [with X = std::vector&]': :25:51: required from here :21:7: error: 'std::vector&' is not a class, struct, or union type 21 | using ConstSpanType = span::value_type>; | ^ :25:10: error: template argument 1 is invalid 25 | std::is_same_v&>, span>); | ^~~~ Compiler returned: 1 https://godbolt.org/z/ir4U26
[Bug c++/61994] New: constexpr vector array ICE [4.9.1 regression]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61994 Bug ID: 61994 Summary: constexpr vector array ICE [4.9.1 regression] Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jeremy at jeremyms dot com
[Bug c++/61994] constexpr vector array ICE [4.9.1 regression]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61994 --- Comment #1 from Jeremy Maitin-Shepard --- With gcc 4.9.1: The following test program produces an ICE: typedef unsigned long limb_t __attribute__ ((__vector_size__ (16), __may_alias__)); struct X { limb_t limb = {1,1}; }; const X table[1][1] = {{ {} }}; g++ -std=c++11 -c test.cpp test.cpp:7:31: internal compiler error: output_operand: invalid expression as operand const X table[1][1] = {{ {} }}; ^ With gcc 4.9.0, the program compiles correctly.