[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2016-10-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

Jonathan Wakely  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #15 from Jonathan Wakely  ---
.

[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2016-07-07 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |7.0

--- Comment #14 from Andrew Pinski  ---
Fixed.

[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2016-05-30 Thread ville.voutilainen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

--- Comment #13 from Ville Voutilainen  ---
Right, that was fixed in the immediately following revision,
https://gcc.gnu.org/viewcvs/gcc?view=revision=236823

[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2016-05-30 Thread krebbel at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

--- Comment #12 from Andreas Krebbel  ---
(In reply to Ville Voutilainen from comment #11)
> I don't see how any of that code or the failure is in any way related to
> std::tuple...

This was the wrong error message.  The bootstrap problem triggered by your
patch has probably been fixed already. This was the message from your patch:

In file included from
/home/andreas/patched/gcc-7.0.0-31-30052016-build/s390-ibm-linux-gnu/libstdc++-v3/include/functional:55:0,
 from
/home/andreas/gcc/libstdc++-v3/include/precompiled/stdc++.h:71:
/home/andreas/patched/gcc-7.0.0-31-30052016-build/s390-ibm-linux-gnu/libstdc++-v3/include/tuple:632:27:
error: 'Elements' was not declared in this scope
 && !is_same>::value,
  ^~
/home/andreas/patched/gcc-7.0.0-31-30052016-build/s390-ibm-linux-gnu/libstdc++-v3/include/tuple:634:35:
error: template argument 1 is invalid
   _Elements...>;
   ^
/home/andreas/patched/gcc-7.0.0-31-30052016-build/s390-ibm-linux-gnu/libstdc++-v3/include/tuple:669:19:
error: '_TMCT' was not declared in this scope
 enable_if<_TMCT<_UElements...>::template
   ^
/home/andreas/patched/gcc-7.0.0-31-30052016-build/s390-ibm-linux-gnu/libstdc++-v3/include/tuple:669:35:
error: expected parameter pack before '...'


[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2016-05-30 Thread ville.voutilainen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

--- Comment #11 from Ville Voutilainen  ---
I don't see how any of that code or the failure is in any way related to
std::tuple...

[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2016-05-30 Thread krebbel at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

Andreas Krebbel  changed:

   What|Removed |Added

 CC||krebbel at gcc dot gnu.org

--- Comment #10 from Andreas Krebbel  ---
(In reply to ville from comment #9)
> Author: ville
> Date: Fri May 27 14:08:37 2016
> New Revision: 236822
> 
> URL: https://gcc.gnu.org/viewcvs?rev=236822=gcc=rev
> Log:
> 2016-05-24  Ville Voutilainen  
> 
>   PR libstdc++/66338
>   * include/std/tuple (_TMC): Add a check for _NotSameTuple.
>   * include/std/tuple (tuple(_UElements&&...)): Remove the separate
>   check for _NotSameTuple.
>   * include/std/tuple (_TMCT): New.
>   * include/std/tuple (tuple(const tuple<_UElements...>&)): Use it.
>   * include/std/tuple (tuple(tuple<_UElements...>&&)): Likewise.
>   * include/std/tuple (tuple(allocator_arg_t, const _Alloc&,
> const tuple<_UElements...>&)): Likewise.
>   * include/std/tuple (tuple(allocator_arg_t, const _Alloc&,
> tuple<_UElements...>&&)): Likewise.
>   * testsuite/20_util/tuple/cons/66338.cc: New.

S/390 32 bit bootstrap appears to fail in stage 2 starting with that change:

In file included from /home/andreas/clean/../gcc/gcc/config/s390/s390.c:41:0:
/home/andreas/clean/../gcc/gcc/recog.h: In function 'rtx_def*
s390_expand_builtin(tree, rtx, rtx, machine_mode, int)':
/home/andreas/clean/../gcc/gcc/recog.h:306:136: error: 'op[5]' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx
a6) const { return ((f7)func) (a0, a1, a2, a3, a4, a5, a6); }
   
^
/home/andreas/clean/../gcc/gcc/config/s390/s390.c:799:7: note: 'op[5]' was
declared here
   rtx op[MAX_ARGS], pat;
   ^~

[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2016-05-27 Thread ville at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

--- Comment #9 from ville at gcc dot gnu.org ---
Author: ville
Date: Fri May 27 14:08:37 2016
New Revision: 236822

URL: https://gcc.gnu.org/viewcvs?rev=236822=gcc=rev
Log:
2016-05-24  Ville Voutilainen  

PR libstdc++/66338
* include/std/tuple (_TMC): Add a check for _NotSameTuple.
* include/std/tuple (tuple(_UElements&&...)): Remove the separate
check for _NotSameTuple.
* include/std/tuple (_TMCT): New.
* include/std/tuple (tuple(const tuple<_UElements...>&)): Use it.
* include/std/tuple (tuple(tuple<_UElements...>&&)): Likewise.
* include/std/tuple (tuple(allocator_arg_t, const _Alloc&,
  const tuple<_UElements...>&)): Likewise.
* include/std/tuple (tuple(allocator_arg_t, const _Alloc&,
  tuple<_UElements...>&&)): Likewise.
* testsuite/20_util/tuple/cons/66338.cc: New.

Added:
trunk/libstdc++-v3/testsuite/20_util/tuple/cons/66338.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/std/tuple

[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2016-05-24 Thread ville.voutilainen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

--- Comment #8 from Ville Voutilainen  ---
Patch available: https://gcc.gnu.org/ml/gcc-patches/2016-05/msg01914.html

[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2015-12-24 Thread ville.voutilainen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

--- Comment #7 from Ville Voutilainen  ---
Not so simple, still working on this.

[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2015-12-20 Thread ville.voutilainen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

--- Comment #6 from Ville Voutilainen  ---
Should be a simple matter of doing the _NonNestedTuple checks before other
checks. Patch coming in a couple of days.

[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2015-12-20 Thread ville.voutilainen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

Ville Voutilainen  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2015-12-20
 CC||ville.voutilainen at gmail dot 
com
   Assignee|unassigned at gcc dot gnu.org  |ville.voutilainen at 
gmail dot com
 Ever confirmed|0   |1

--- Comment #5 from Ville Voutilainen  ---
Mine.

[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2015-05-30 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

--- Comment #4 from Jonathan Wakely redi at gcc dot gnu.org ---
(In reply to Pawel Tomulik from comment #2)
 Anyway, adding explicit to S(T) solves the problem...

Or constrain your greedy template so it only accepts arguments that can be
assigned to S::i_

struct S {
  int i_;

  templatetypename T,
   typename Require = decltype(std::declvalint()
   = std::declvalT())
  S(T i)
noexcept(noexcept(i_ = i))
  { i_ = i; }

  S() noexcept : i_{0} {};
};


[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2015-05-30 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

--- Comment #3 from Jonathan Wakely redi at gcc dot gnu.org ---
I think this is expected, because your type S has an unconstrained constructor
template that accepts any argument, including objects of type tupleS, but in
the signature of that constructor (specifically in the exception-specification)
you use the argument in an expression that might be invalid.

The tuple constructor is constexpr, so that invalid expression causes an error.

I'm not sure, but this might be fixed by implementing this change to the
standard: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4387


[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2015-05-29 Thread ptomulik at meil dot pw.edu.pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

--- Comment #2 from Pawel Tomulik ptomulik at meil dot pw.edu.pl ---
I found this to be related to std::tuple constructors, especially this one:

  templatetypename... _UElements, typename = typename
enable_if__and_is_convertible_UElements,
_Elements...::value::type
explicit
constexpr tuple(_UElements... __elements)
: _Inherited(std::forward_UElements(__elements)...) { }


in some circumstances it gets precedence over the copy constructor.. for
example:

/
#include tuple

struct S {
  int i_;

  templatetypename T
  S(T i)
  { i_ = i; }

  S() noexcept : i_{0} {};
};

int main()
{
  S const s{};
  std::tupleS t1{s};
  std::tupleS{t1}; // well... tupleS looks like being convertible to S
  return 0;
}


ptomulik@barakus:$ g++ -Wall -Wextra -Werror -pedantic -g -O0 -std=c++11 -o
test-gcc test.cpp
test.cpp: In instantiation of ‘S::S(T) [with T = std::tupleS]’:
/usr/include/c++/4.9/tuple:142:42:   required from ‘constexpr
std::_Head_base_Idx, _Head, false::_Head_base(_UHead) [with _UHead =
std::tupleS; long unsigned int _Idx = 0ul; _Head = S]’
/usr/include/c++/4.9/tuple:264:38:   required from ‘constexpr
std::_Tuple_impl_Idx, _Head, _Tail ...::_Tuple_impl(_UHead, _UTail ...)
[with _UHead = std::tupleS; _UTail = {}; template-parameter-2-3 = void;
long unsigned int _Idx = 0ul; _Head = S; _Tail = {}]’
/usr/include/c++/4.9/tuple:407:54:   required from ‘constexpr std::tuple
template-parameter-1-1 ::tuple(_UElements ...) [with _UElements =
{std::tupleS}; template-parameter-2-2 = void; _Elements = {S}]’
test.cpp:17:19:   required from here
test.cpp:8:8: error: cannot convert ‘std::tupleS’ to ‘int’ in assignment
   { i_ = i; }


Is it intended?


Anyway, adding explicit to S(T) solves the problem...

[Bug libstdc++/66338] std::forward_as_tuple() issue with single argument

2015-05-29 Thread ptomulik at meil dot pw.edu.pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66338

--- Comment #1 from Pawel Tomulik ptomulik at meil dot pw.edu.pl ---
As a side note, the following variant also does not compile:


int main()  
{   
  S const s{};  
  std::tupleS const(std::forward_as_tuple(s));   
  return 0; 
}


but the non-const lvalue reference goes smoothly:

int main()  
{   
  S s{};
  std::tupleS(std::forward_as_tuple(s)); 
  return 0; 
}