public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3
@ 2013-01-15 16:53 jnapoli at alum dot mit.edu
  2013-01-15 17:26 ` [Bug libstdc++/55993] " redi at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: jnapoli at alum dot mit.edu @ 2013-01-15 16:53 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55993
           Summary: tuple_cat not a constant expression for result size >=
                    3
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jnapoli@alum.mit.edu


Created attachment 29171
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29171
pre-processed test case

I expect the following code to compile:

#include <tuple>
struct A {};
constexpr auto tuple = std::tuple_cat( std::make_tuple( A(), A() ),
std::make_tuple( A() ) );

However, it fails with "... is not a constant expression". It looks like
tuple_cat is not a constant expression when it returns a tuple of length three
or more.


Here's the full error output:

$ g++ -v -Wall -Wextra -std=c++11 constexpr_tuple_cat.cpp
Using built-in specs.
COLLECT_GCC=C:\MinGW\bin\g++.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.7.2/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.7.2/configure
--enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions
--with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry
--enable-libstdcxx-debug --disable-build-poststage1-with-cxx
--enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.7.2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-Wall' '-Wextra' '-std=c++11' '-shared-libgcc'
'-mtune=i386' '-march=i386'
 c:/mingw/bin/../libexec/gcc/mingw32/4.7.2/cc1plus.exe -quiet -v -iprefix
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/ constexpr_tuple_cat.cpp -quiet -dumpbase
constexpr_tuple_cat.cpp -mtune=i386 -march=i386 -auxbase constexpr_tuple_cat
-Wall -Wextra -std=c++11 -version -o
C:\Users\jnapoli\AppData\Local\Temp\cc2YWCJS.s
GNU C++ (GCC) version 4.7.2 (mingw32)
        compiled by GNU C version 4.7.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
ignoring nonexistent directory
"c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../mingw32/include"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.2/include/c++"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.2/include/c++/mingw32"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.2/include/c++/backward"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.2/include"
ignoring duplicate directory "/mingw/lib/gcc/mingw32/4.7.2/../../../../include"
ignoring duplicate directory "c:/mingw/lib/gcc/../../include"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.2/include-fixed"
ignoring nonexistent directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.2/../../../../mingw32/include"
ignoring duplicate directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++
 c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/mingw32
 c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/backward
 c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include
 c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include
 c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include-fixed
End of search list.
GNU C++ (GCC) version 4.7.2 (mingw32)
        compiled by GNU C version 4.7.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: fdc0bc7c97f61ac24bf8edb5646b3bc3
constexpr_tuple_cat.cpp:3:92:   in constexpr expansion of
'std::tuple_cat(_Tpls&& ...) [with _Tpls = {std::tuple<A, A>, std::tuple<A>};
<template-parameter-1-2> = void; typename std::__tuple_cat_result<_Tpls
...>::__type = std::tuple<A, A, A>]((* & std::make_tuple(_Elements&& ...) [with
_Elements = {A}; typename std::__decay_and_strip<_Elements>::__type = <type
error>]()))'
constexpr_tuple_cat.cpp:3:92:   in constexpr expansion of
'std::__tuple_concater<_Ret, std::_Index_tuple<_Is ...>, _Tp, _Tpls
...>::_S_do(_Tp&&, _Tpls&& ..., _Us&& ...) [with _Us = {}; _Ret = std::tuple<A,
A, A>; unsigned int ..._Is = {0u, 1u}; _Tp = std::tuple<A, A>; _Tpls =
{std::tuple<A>}]((* & std::forward<std::tuple<A> >((* & __tpls#1))))'
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/tuple:1009:52:   in constexpr
expansion of 'std::get<0u, {A, A}>((* & std::forward<std::tuple<A, A> >((* &
__tp))))'
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/tuple:759:45:   in constexpr
expansion of 'std::get<0u, {A, A}>((* & __t))'
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/tuple:744:35:   in constexpr
expansion of 'std::__get_helper<0u, A, {A}>((*(std::_Tuple_impl<0u, A, A>*)(&
__t)))'
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/tuple:729:60:   in constexpr
expansion of 'std::_Tuple_impl<_Idx, _Head, _Tail ...>::_M_head<0u, A, {A}>((*
& __t))'
constexpr_tuple_cat.cpp:3:92: error: '(std::_Head_base<0u, A, true>*)(&
std::tuple<A, A>())' is not a constant expression


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

* [Bug libstdc++/55993] tuple_cat not a constant expression for result size >= 3
  2013-01-15 16:53 [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3 jnapoli at alum dot mit.edu
@ 2013-01-15 17:26 ` redi at gcc dot gnu.org
  2013-01-15 17:29 ` redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2013-01-15 17:26 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-01-15
     Ever Confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-15 17:26:15 UTC ---
The problem is with 'get' not 'tuple_cat', the bug reduces to:

#include <tuple>
struct A {};
constexpr auto t = std::get<0>( std::make_tuple( A(), A() ) );


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

* [Bug libstdc++/55993] tuple_cat not a constant expression for result size >= 3
  2013-01-15 16:53 [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3 jnapoli at alum dot mit.edu
  2013-01-15 17:26 ` [Bug libstdc++/55993] " redi at gcc dot gnu.org
@ 2013-01-15 17:29 ` redi at gcc dot gnu.org
  2013-01-15 18:44 ` jnapoli at alum dot mit.edu
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2013-01-15 17:29 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-15 17:28:42 UTC ---
#include <tuple>
struct A {};
constexpr auto t = std::make_tuple( A(), A() );
constexpr auto a = std::get<0>( t );

t.cc:4:35: error: accessing value of 't' through a 'const A' glvalue in a
constant expression
 constexpr auto a = std::get<0>( t );
                                   ^

Huh?


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

* [Bug libstdc++/55993] tuple_cat not a constant expression for result size >= 3
  2013-01-15 16:53 [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3 jnapoli at alum dot mit.edu
  2013-01-15 17:26 ` [Bug libstdc++/55993] " redi at gcc dot gnu.org
  2013-01-15 17:29 ` redi at gcc dot gnu.org
@ 2013-01-15 18:44 ` jnapoli at alum dot mit.edu
  2013-01-15 19:15 ` [Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jnapoli at alum dot mit.edu @ 2013-01-15 18:44 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Joshua Napoli <jnapoli at alum dot mit.edu> 2013-01-15 18:44:10 UTC ---
The problem has to do with a completely empty struct being used twice
consecutively in the tuple type list. std::tuple<A,A> inherits from A (by
inheriting _Head_base<A> which inherits A). Maybe there is a problem with
confusing the inherited types when struct A is empty and the base A might not
have a separate address from the top-level tuple.



It compiles OK when I add a member variable:

struct A { constexpr A() : x(0) {} int x; };
constexpr std::tuple<A,A> t;
constexpr auto a = decltype(t)::_M_head(t);



But fails without it:

struct A { constexpr A() /*: x(0)*/ {} /*int x;*/ };
constexpr std::tuple<A,A> t;
constexpr auto a = decltype(t)::_M_head(t);



It compiles OK when I use two different classes

struct A { constexpr A() {} };
struct B { constexpr B() {} };
constexpr std::tuple<A,B> t;
constexpr auto a = decltype(t)::_M_head(t);



If fails to build with two As and a B:

struct A { constexpr A() {} };
struct B { constexpr B() {} };
constexpr std::tuple<A,A,B> t;
constexpr auto a = decltype(t)::_M_head(t);



(Note that std::get<0>( std::tuple<...> ) returns std::tuple<...>::_M_head(t).)


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

* [Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression
  2013-01-15 16:53 [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3 jnapoli at alum dot mit.edu
                   ` (2 preceding siblings ...)
  2013-01-15 18:44 ` jnapoli at alum dot mit.edu
@ 2013-01-15 19:15 ` redi at gcc dot gnu.org
  2013-01-15 19:24 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2013-01-15 19:15 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
          Component|libstdc++                   |c++
            Summary|tuple_cat not a constant    |[C++11] derived-to-base
                   |expression for result size  |conversion fails in
                   |>= 3                        |constant expression
      Known to fail|                            |4.6.3, 4.7.3, 4.8.0

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-15 19:15:36 UTC ---
This seems to be a C++ front end bug, here's the code reduced to remove library
dependencies:

template<int N, typename T>
struct Head : T
{ };

template<int N, typename... T>
struct Tuple;

template<int N>
struct Tuple<N>
{ };

template<int N, typename T, typename... U>
struct Tuple<N, T, U...> : Tuple<N+1, U...>, Head<N, T>
{ };

template<typename T, typename U>
struct tuple : Tuple<0, T, U>
{ };

struct A { };
constexpr tuple<A, A> t{};
constexpr auto a = static_cast<const Head<0, A>&>(t);


tt.cc:22:52: error: accessing value of 't' through a 'const Head<0, A>' glvalue
in a constant expression
 constexpr auto a = static_cast<const Head<0, A>&>(t);
                                                    ^


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

* [Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression
  2013-01-15 16:53 [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3 jnapoli at alum dot mit.edu
                   ` (3 preceding siblings ...)
  2013-01-15 19:15 ` [Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression redi at gcc dot gnu.org
@ 2013-01-15 19:24 ` redi at gcc dot gnu.org
  2013-01-15 19:27 ` jnapoli at alum dot mit.edu
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2013-01-15 19:24 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-15 19:24:03 UTC ---
Further reduced:

struct A { };

template<int N>
struct Head : A
{ };

struct Tuple : Head<0>, Head<1>
{ };

constexpr Tuple t{};
constexpr auto a = static_cast<const Head<1>&>(t);


tt.cc:11:49: error: accessing value of 't' through a 'const Head<1>' glvalue in
a constant expression


This only fails if the target of the cast is not the first base class (i.e.
accessing Head<1>) and if Head<N> derives from A, i.e. Tuple has two base
classes of type A


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

* [Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression
  2013-01-15 16:53 [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3 jnapoli at alum dot mit.edu
                   ` (4 preceding siblings ...)
  2013-01-15 19:24 ` redi at gcc dot gnu.org
@ 2013-01-15 19:27 ` jnapoli at alum dot mit.edu
  2013-01-15 19:34 ` glisse at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jnapoli at alum dot mit.edu @ 2013-01-15 19:27 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Joshua Napoli <jnapoli at alum dot mit.edu> 2013-01-15 19:26:49 UTC ---
Awesome reduction of the bug!


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

* [Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression
  2013-01-15 16:53 [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3 jnapoli at alum dot mit.edu
                   ` (5 preceding siblings ...)
  2013-01-15 19:27 ` jnapoli at alum dot mit.edu
@ 2013-01-15 19:34 ` glisse at gcc dot gnu.org
  2013-01-15 19:39 ` glisse at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-01-15 19:34 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #7 from Marc Glisse <glisse at gcc dot gnu.org> 2013-01-15 19:34:17 UTC ---
struct A {};
struct B:A {};
struct C:A {};
struct D:B,C {};

constexpr D d;
constexpr const C& e=d; // OK
constexpr auto f=static_cast<const C&>(d); // FAIL
constexpr auto g=static_cast<const B&>(d); // FAIL different

Interesting mix of error messages:

e.cc:8:41: error: accessing value of 'd' through a 'const C' glvalue in a
constant expression
 constexpr auto f=static_cast<const C&>(d); // FAIL
                                         ^
e.cc:9:41: error: the value of 'd' is not usable in a constant expression
 constexpr auto g=static_cast<const B&>(d); // FAIL different
                                         ^
e.cc:6:13: note: 'd' used in its own initializer
 constexpr D d;
             ^


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

* [Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression
  2013-01-15 16:53 [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3 jnapoli at alum dot mit.edu
                   ` (6 preceding siblings ...)
  2013-01-15 19:34 ` glisse at gcc dot gnu.org
@ 2013-01-15 19:39 ` glisse at gcc dot gnu.org
  2013-02-13 17:57 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-01-15 19:39 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from Marc Glisse <glisse at gcc dot gnu.org> 2013-01-15 19:38:46 UTC ---
(In reply to comment #7)
> e.cc:9:41: error: the value of 'd' is not usable in a constant expression
>  constexpr auto g=static_cast<const B&>(d); // FAIL different
>                                          ^
> e.cc:6:13: note: 'd' used in its own initializer
>  constexpr D d;
>              ^

Those are just because of the missing {} after the declaration of d, the
messages are not optimal, but forget my last comment.

It's just that the error is not exactly in the derived to base conversion but
trying to use that value afterwards.


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

* [Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression
  2013-01-15 16:53 [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3 jnapoli at alum dot mit.edu
                   ` (7 preceding siblings ...)
  2013-01-15 19:39 ` glisse at gcc dot gnu.org
@ 2013-02-13 17:57 ` jason at gcc dot gnu.org
  2013-02-15 19:28 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-13 17:57 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-13 17:56:33 UTC ---
Author: jason
Date: Wed Feb 13 17:56:28 2013
New Revision: 196023

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196023
Log:
    PR c++/55993
    * semantics.c (cxx_fold_indirect_ref): Handle empty bases at
    non-zero offsets, too.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-empty6.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c


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

* [Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression
  2013-01-15 16:53 [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3 jnapoli at alum dot mit.edu
                   ` (8 preceding siblings ...)
  2013-02-13 17:57 ` jason at gcc dot gnu.org
@ 2013-02-15 19:28 ` jason at gcc dot gnu.org
  2015-02-26 15:49 ` splinterofchaos at gmail dot com
  2015-02-26 17:12 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-15 19:28 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.8.0

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-15 19:28:07 UTC ---
Fixed in 4.8 for now.


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

* [Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression
  2013-01-15 16:53 [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3 jnapoli at alum dot mit.edu
                   ` (9 preceding siblings ...)
  2013-02-15 19:28 ` jason at gcc dot gnu.org
@ 2015-02-26 15:49 ` splinterofchaos at gmail dot com
  2015-02-26 17:12 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: splinterofchaos at gmail dot com @ 2015-02-26 15:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55993

splinterofchaos at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |splinterofchaos at gmail dot com

--- Comment #11 from splinterofchaos at gmail dot com ---
I still get an error with 4.9 when using one of the less reduced cases,
although not when using the test cases in that patch.


#include <tuple>
struct A {};
constexpr auto t = std::get<0>( std::make_tuple( A(), A() ) );


$ g++ test.cpp -std=c++14 -Wall -Wextra; and ./a.out; echo $status
test.cpp:3:61:   in constexpr expansion of ‘std::get<0ul, {A, A}>((* &
std::make_tuple(_Elements&& ...) [with _Elements = {A, A}]((* & A()))))’
/usr/include/c++/4.9/tuple:774:44:   in constexpr expansion of ‘std::get<0ul,
{A, A}>((* & __t))’
/usr/include/c++/4.9/tuple:757:40:   in constexpr expansion of
‘std::__get_helper<0ul, A, {A}>((*(std::_Tuple_impl<0ul, A, A>*)(& __t)))’
/usr/include/c++/4.9/tuple:744:60:   in constexpr expansion of
‘std::_Tuple_impl<_Idx, _Head, _Tail ...>::_M_head<0ul, A, {A}>((* & __t))’
test.cpp:3:61: error: ‘(std::_Head_base<0ul, A, true>*)(& std::tuple<A, A>())’
is not a constant expression
 constexpr auto t = std::get<0>( std::make_tuple( A(), A() ) );


$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.9.1-16ubuntu6'
--with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.1 (Ubuntu 4.9.1-16ubuntu6)
>From gcc-bugs-return-478603-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Feb 26 14:55:55 2015
Return-Path: <gcc-bugs-return-478603-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 107945 invoked by alias); 26 Feb 2015 14:55:55 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 107905 invoked by uid 48); 26 Feb 2015 14:55:51 -0000
From: "dcb314 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/64570] error: non-trivial conversion at assignment
Date: Thu, 26 Feb 2015 15:54:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dcb314 at hotmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64570-4-CUzGCB17rs@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64570-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64570-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-02/txt/msg02935.txt.bz2
Content-length: 323

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd570

--- Comment #3 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Richard Biener from comment #2)
> Fails everywhere, 4.6 rejects the testcase.  Looks more like a C++ frontend
> issue to me.

Still goes wrong over a month later with trunk dated 20150225.


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

* [Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression
  2013-01-15 16:53 [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3 jnapoli at alum dot mit.edu
                   ` (10 preceding siblings ...)
  2015-02-26 15:49 ` splinterofchaos at gmail dot com
@ 2015-02-26 17:12 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2015-02-26 17:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55993

--- Comment #12 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to splinterofchaos from comment #11)
> I still get an error with 4.9 when using one of the less reduced cases,
> although not when using the test cases in that patch.
> 
> 
> #include <tuple>
> struct A {};
> constexpr auto t = std::get<0>( std::make_tuple( A(), A() ) );

This seems to be fixed on the trunk (GCC 5).


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

end of thread, other threads:[~2015-02-26 16:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-15 16:53 [Bug libstdc++/55993] New: tuple_cat not a constant expression for result size >= 3 jnapoli at alum dot mit.edu
2013-01-15 17:26 ` [Bug libstdc++/55993] " redi at gcc dot gnu.org
2013-01-15 17:29 ` redi at gcc dot gnu.org
2013-01-15 18:44 ` jnapoli at alum dot mit.edu
2013-01-15 19:15 ` [Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression redi at gcc dot gnu.org
2013-01-15 19:24 ` redi at gcc dot gnu.org
2013-01-15 19:27 ` jnapoli at alum dot mit.edu
2013-01-15 19:34 ` glisse at gcc dot gnu.org
2013-01-15 19:39 ` glisse at gcc dot gnu.org
2013-02-13 17:57 ` jason at gcc dot gnu.org
2013-02-15 19:28 ` jason at gcc dot gnu.org
2015-02-26 15:49 ` splinterofchaos at gmail dot com
2015-02-26 17:12 ` 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).