public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48350] New: make_tuple() on empty tuples does not compile
@ 2011-03-30  5:33 tinlyx at gmail dot com
  2011-03-30  8:04 ` [Bug c++/48350] " tinlyx at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: tinlyx at gmail dot com @ 2011-03-30  5:33 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: make_tuple() on empty tuples does not compile
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tinlyx@gmail.com


Created attachment 23810
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23810
the example

g++ 4.5.2 cannot create a unary tuple that contains an empty tuple (i.e.
tuple<>() ) as the content. Minimal code example is as follows:

//a.cpp
#include <tuple>
using namespace std;

int main() {
  auto te = make_tuple();
  auto tte = make_tuple(te);
  return 0;
}


////
Compiling the above generates an error about
invalid static_cast from type 'std::tuple<>' to type 'const
std::_Tuple_impl<0u>&'

Detailed compiler output is below:

$ gcc -v -save-temps -std=c++0x a.cpp
Using built-in specs.
COLLECT_GCC=C:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.5.2/configure
--enable-languages=c,c++,ada,fortran,obj
c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared
--enable-libgo
mp --disable-win32-registry --enable-libstdcxx-debug
--enable-version-specific-r
untime-libs --disable-werror --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.5.2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++0x' '-mtune=i386' '-march=i386'
 c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/cc1plus.exe -E -quiet -v -iprefix
c:\
mingw\bin\../lib/gcc/mingw32/4.5.2/ a.cpp -mtune=i386 -march=i386 -std=c++0x
-fp
ch-preprocess -o a.ii
ignoring nonexistent directory
"c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../.
./mingw32/include"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/inclu
de/c++"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/inclu
de/c++/mingw32"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/inclu
de/c++/backward"
ignoring duplicate directory "/mingw/lib/gcc/mingw32/4.5.2/../../../../include"
ignoring duplicate directory "c:/mingw/lib/gcc/../../include"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/inclu
de"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/inclu
de-fixed"
ignoring nonexistent directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/../
../../../mingw32/include"
ignoring duplicate directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include/c++
 c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include/c++/mingw32
 c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include/c++/backward
 c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include
 c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include
 c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include-fixed
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++0x' '-mtune=i386' '-march=i386'
 c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/cc1plus.exe -fpreprocessed a.ii
-quie
t -dumpbase a.cpp -mtune=i386 -march=i386 -auxbase a -std=c++0x -version -o a.s
GNU C++ (GCC) version 4.5.2 (mingw32)
        compiled by GNU C version 4.5.2, GMP version 5.0.1, MPFR version 2.4.1,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 4.5.2 (mingw32)
        compiled by GNU C version 4.5.2, GMP version 5.0.1, MPFR version 2.4.1,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: bba7c68567cab1560329ee702fa8a945
In file included from a.cpp:1:0:
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include/c++/tuple: In constructor
'std::tu
ple<_Elements>::tuple(std::tuple<_UElements ...>&) [with _UElements = {},
_Eleme
nts = {std::tuple<>}]':
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include/c++/tuple:551:62:   instantiated
f
rom 'std::tuple<typename std::__decay_and_strip<_Elements>::__type ...>
std::mak
e_tuple(_Elements&& ...) [with _Elements = {std::tuple<>&}, typename
std::__deca
y_and_strip<_Elements>::__type = <type error>]'
a.cpp:6:27:   instantiated from here
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include/c++/tuple:259:70: error: invalid
s
tatic_cast from type 'std::tuple<>' to type 'const std::_Tuple_impl<0u>&'


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

* [Bug c++/48350] make_tuple() on empty tuples does not compile
  2011-03-30  5:33 [Bug c++/48350] New: make_tuple() on empty tuples does not compile tinlyx at gmail dot com
@ 2011-03-30  8:04 ` tinlyx at gmail dot com
  2011-03-30 10:01 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: tinlyx at gmail dot com @ 2011-03-30  8:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from tinlyx at gmail dot com 2011-03-30 07:28:55 UTC ---
As a matter of fact, make_tuple() cannot be used on any tuples with cardinality
other than 1. This contrasts with std::vector where we can have a vector of
vectors (e.g. a matrix).

A minimal example is listed below:

//b.cpp
#include <tuple>
using namespace std;

int main() {
  //auto te = make_tuple();     //this doesn't work
  auto te = make_tuple(1);      //this works
  //auto te = make_tuple(1,2);  //this doesn't work
  auto tte = make_tuple(te);
  return 0;
}



//////////
//The compiler error message is omitted, but I can upload it if necessary.


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

* [Bug c++/48350] make_tuple() on empty tuples does not compile
  2011-03-30  5:33 [Bug c++/48350] New: make_tuple() on empty tuples does not compile tinlyx at gmail dot com
  2011-03-30  8:04 ` [Bug c++/48350] " tinlyx at gmail dot com
@ 2011-03-30 10:01 ` redi at gcc dot gnu.org
  2011-03-30 10:04 ` redi at gcc dot gnu.org
  2011-03-30 10:51 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-30 10:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-30 09:41:26 UTC ---
works ok with 4.6.0


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

* [Bug c++/48350] make_tuple() on empty tuples does not compile
  2011-03-30  5:33 [Bug c++/48350] New: make_tuple() on empty tuples does not compile tinlyx at gmail dot com
  2011-03-30  8:04 ` [Bug c++/48350] " tinlyx at gmail dot com
  2011-03-30 10:01 ` redi at gcc dot gnu.org
@ 2011-03-30 10:04 ` redi at gcc dot gnu.org
  2011-03-30 10:51 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-30 10:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-30 09:49:20 UTC ---
probably fixed by PR 45228


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

* [Bug c++/48350] make_tuple() on empty tuples does not compile
  2011-03-30  5:33 [Bug c++/48350] New: make_tuple() on empty tuples does not compile tinlyx at gmail dot com
                   ` (2 preceding siblings ...)
  2011-03-30 10:04 ` redi at gcc dot gnu.org
@ 2011-03-30 10:51 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-30 10:51 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-30 10:47:42 UTC ---
confirmed as a dup - the constructor that caused the error was removed for PR
45228 and we now constrain the variadic constructor to only match when the
number of parameters is correct

*** This bug has been marked as a duplicate of bug 45228 ***


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

end of thread, other threads:[~2011-03-30 10:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-30  5:33 [Bug c++/48350] New: make_tuple() on empty tuples does not compile tinlyx at gmail dot com
2011-03-30  8:04 ` [Bug c++/48350] " tinlyx at gmail dot com
2011-03-30 10:01 ` redi at gcc dot gnu.org
2011-03-30 10:04 ` redi at gcc dot gnu.org
2011-03-30 10:51 ` redi 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).