http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49356
Summary: C++0x decltype fails with recursive template function Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: jarr...@cse.unsw.edu.au Created attachment 24483 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24483 Recursion with decltype fails. When decltype refers to the type of a recursive instantiation of the same template function, it fails. The command line and output for the attached file (the preprocessed version is attached) is as follows: g++ --std=gnu++0x recurse.cpp -fmessage-length=72 -save-temps recurse.cpp: In function ‘int main(int, char**)’: recurse.cpp:43:20: error: no matching function for call to ‘multiply( Multiplier&, int, int, int)’ recurse.cpp:43:20: note: candidates are: recurse.cpp:25:22: note: template<class T, class Last> decltype (t(last)) multiply(T&, Last) recurse.cpp:33:40: note: template<class T, class First, class ... Values> decltype (multiply(t(f), multiply::values ...)) multiply(T&, First, Values ...) Here are my gcc specs. g++ -v: Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/home/jarryd/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /home/jarryd/current/soft/src/gcc-svn/configure --prefix=/home/jarryd/current/soft/install-latest --disable-multilib --enable-languages=c,c++,go : (reconfigured) /home/jarryd/current/soft/src/gcc-svn/configure --prefix=/home/jarryd/current/soft/install-latest --disable-multilib --enable-languages=c,c++,go,lto --no-create --no-recursion Thread model: posix gcc version 4.7.0 20110609 (experimental) (GCC)