public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49356] New: C++0x decltype fails with recursive template function
@ 2011-06-10  2:01 jarrydb at cse dot unsw.edu.au
  2011-06-15 17:06 ` [Bug c++/49356] [C++0x] " jason at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: jarrydb at cse dot unsw.edu.au @ 2011-06-10  2:01 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: jarrydb@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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/49356] [C++0x] decltype fails with recursive template function
  2011-06-10  2:01 [Bug c++/49356] New: C++0x decltype fails with recursive template function jarrydb at cse dot unsw.edu.au
@ 2011-06-15 17:06 ` jason at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-15 17:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49356

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |froydnj at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org
         Resolution|                            |INVALID

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-15 17:05:38 UTC ---
The problem here is that t(f) is an rvalue, so it can't bind to the non-const
T& parameter in the recursive call.

Nathan has a patch in the works that should produce more helpful diagnostics
for this sort of situation.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-15 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-10  2:01 [Bug c++/49356] New: C++0x decltype fails with recursive template function jarrydb at cse dot unsw.edu.au
2011-06-15 17:06 ` [Bug c++/49356] [C++0x] " jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).