[Bug c++/57543] New: decltype needs eplicity 'this' pointer in member function declaration of template class with trailing return type
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57543 Bug ID: 57543 Summary: decltype needs eplicity 'this' pointer in member function declaration of template class with trailing return type Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mitchnull+gcc at gmail dot com Created attachment 30268 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30268&action=edit decltype-implicit-this.cpp When using trailing return-type for member functions of a template class, the 'this' pointer must be explicitly mentioned. This should not be necessary (The implicit 'this' works with a non-template class). Example: emplate struct DecltypeConstThis { T f() const { return T{}; } auto g() -> decltype(this->f()) { return this->f(); } auto h() const -> decltype(f()) { return f(); } // this should work the same as g() above (with implicit 'this') }; struct Working { int f() const { return 0; } auto h() const -> decltype(f()) { return 0; } }; int main() { Working w; w.h(); DecltypeConstThis d; d.g(); d.h(); return 0; } compiler output: [mitch@deneb src]$ g++ -std=c++11 -o decltype-implicit-this decltype-implicit-this.cpp decltype-implicit-this.cpp: In instantiation of ‘struct DecltypeConstThis’: decltype-implicit-this.cpp:22:28: required from here decltype-implicit-this.cpp:7:36: error: cannot call member function ‘T DecltypeConstThis::f() const [with T = int]’ without object auto h() const -> decltype(f()) { return f(); } // this should work the same as g() above (with implicit 'this') ^ decltype-implicit-this.cpp: In function ‘int main()’: decltype-implicit-this.cpp:24:7: error: ‘struct DecltypeConstThis’ has no member named ‘h’ d.h(); ^ ps: possibly related to bug #54359
[Bug c++/53039] New: [C++11]including breaks std::is_convertible with template-pack expansion
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53039 Bug #: 53039 Summary: [C++11]including breaks std::is_convertible with template-pack expansion Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: mitchnull+...@gmail.com Created attachment 27185 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27185 test code #include in the following code causes compile failure. Without the include, it compiles fine: #include #include // without this include, it compiles template struct Bools { static const bool value = true; }; template struct Types { template ::value...>::value, bool>::type = false> int foo(Us&&...) { return sizeof...(Us); } }; int main() { Types t; return t.foo(1, 1); } Output: $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /build/src/gcc-4.7-20120324/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-cloog-backend=isl --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --disable-multilib --disable-libssp --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-checking=release Thread model: posix gcc version 4.8.0 20120407 (experimental) [trunk revision 186212] (Debian 20120407-1) $ /usr/lib/gcc-snapshot/bin/g++ -std=c++11 functional_bug.cpp functional_bug.cpp: In instantiation of 'struct Types': functional_bug.cpp:21:21: required from here functional_bug.cpp:15:9: error: wrong number of template arguments (3, should be 2) In file included from functional_bug.cpp:1:0: /usr/lib/gcc-snapshot/lib/gcc/i486-linux-gnu/4.8.0/../../../../include/c++/4.8.0/type_traits:1264:12: error: provided for 'template struct std::is_convertible' functional_bug.cpp: In function 'int main()': functional_bug.cpp:22:14: error: 'struct Types' has no member named 'foo'
[Bug c++/53039] [C++11]including breaks std::is_convertible with template-pack expansion
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53039 --- Comment #1 from Radics Péter 2012-04-19 07:59:06 UTC --- Created attachment 27186 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27186 4.8.0 output test run by sam of #c++ on freenode
[Bug c++/53039] [C++11]including breaks std::is_convertible with template-pack expansion
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53039 --- Comment #2 from Radics Péter 2012-04-19 08:00:00 UTC --- Created attachment 27187 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27187 4.7.0 output test run on arch linux