[Bug c++/82254] New: std::is_nothrow_invocable is broken

2017-09-19 Thread bolero.murakami at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82254

Bug ID: 82254
   Summary: std::is_nothrow_invocable is broken
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bolero.murakami at gmail dot com
  Target Milestone: ---

std::is_nothrow_invocable is broken.

example:

struct X {
X(int x) { throw x; }
};
int f(int x) noexcept { return x; }
using F = decltype(f);


INVOKE(F, int) throws exception,
but std::is_nothrow_invocable_r_v is true.
Should actually return false.

Run code(wandbox): https://wandbox.org/permlink/WDeMGw6zbAZ7pYk1

[Bug libstdc++/61849] New: exp(NaN+0_i) returns wrong value

2014-07-18 Thread bolero.murakami at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61849

Bug ID: 61849
   Summary: exp(NaN+0_i) returns wrong value
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bolero.murakami at gmail dot com

exp(NaN+0_i) returns NaN+NaN_i.
However, it should returns NaN+0_i correctly.

ISO/IEC 9899:1999
G.6.3.1 The cexp functions
— cexp(NaN + i0) returns NaN + i0.

Code:
//
#include 
#include 
#include 

int main() {
using complex = std::complex;
auto NaN = std::numeric_limits::quiet_NaN();

// should be (nan,0), but (nan,nan)
std::cout << std::exp(complex(NaN, +0.)) << std::endl;
// should be (nan,-0), but (nan,nan)
std::cout << std::exp(complex(NaN, -0.)) << std::endl;
}
//
http://melpon.org/wandbox/permlink/asWdib1m9tY4zICI

[Bug c++/57901] New: [C++11][constexpr] Cannot call-by-value such that class has non-trivial (constexpr) move constructor

2013-07-15 Thread bolero.murakami at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57901

Bug ID: 57901
   Summary: [C++11][constexpr] Cannot call-by-value such that
class has non-trivial (constexpr) move constructor
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bolero.murakami at gmail dot com

Code:
//
struct Z {
Z() = default;
Z(Z const&) = default;
constexpr Z(Z&&) {} /* non-trivial (constexpr) move ctor */
};

template
constexpr int fn0(T v) { return 0; }
template
constexpr int fn (T v) { return fn0(v); }

constexpr auto t0 = fn0(Z()); // OK!
constexpr auto t  = fn (Z()); // error! (GCC 4.8.1, -std=c++11)
//

Error message:
in constexpr expansion of ‘fn(Z())’
error: ‘v’ is not a constant expression
   constexpr auto t = fn(Z());
^


Class Z is literal type.
However, compilation error when it is call-by-value(more than once).

I tested this code in gcc-4.7.3, is passed.
The problem is reproduced in gcc-4.8.0, gcc-4.8.1

[Bug c++/57066] New: std::logb(-inf) returns wrong value

2013-04-25 Thread bolero.murakami at gmail dot com

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

 Bug #: 57066
   Summary: std::logb(-inf) returns wrong value
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: bolero.murak...@gmail.com


auto inf = std::numeric_limits::infinity();
std::cout << std::logb(-inf) << std::endl;

"-inf" is output.
it is wrong.

std::logb(-inf) should returns +inf.
> F.9.3.11 The logb functions
> - logb(±∞) returns +∞.