[Bug libstdc++/48365] New: Non-constant references in std::valarray::operator

2011-03-30 Thread denin at mail dot ru
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48365

   Summary: Non-constant references in std::valarray::operator
   Product: gcc
   Version: 4.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: de...@mail.ru


Created attachment 23819
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=23819
Test code

When calling valarray*scalar arithmetic operators, where scalar is the
element of valarray, it is modified during execution, thus influencig the
result, though STL definition says that parameters of the operator are const
references, and the result is the new valarray object.
Attached is the code that produces output 4:12, while 4:6 expected, even
when compiled with -O0.


[Bug c++/52869] [DR 1207] "this" not being allowed in noexcept clauses

2018-07-29 Thread denin at mail dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52869

denin at mail dot ru changed:

   What|Removed |Added

 CC||denin at mail dot ru

--- Comment #6 from denin at mail dot ru ---
Reproduced in 8.1.1:

$ cat nyan.cpp 
struct Nyan {
constexpr Nyan ++() noexcept { return *this; }
constexpr void omg() noexcept(noexcept(++*this)) {}
};

int main() {}

$ g++ -Wall -Wextra nyan.cpp 
nyan.cpp:3:44: error: invalid use of ‘this’ at top level
  constexpr void omg() noexcept(noexcept(++*this)) {}
^~~~
$ clang++ nyan.cpp 

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --enable-multilib --disable-werror
--enable-checking=release --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 8.1.1 20180531 (GCC) 

$ uname -a
Linux home 4.17.10-1-ARCH #1 SMP PREEMPT Wed Jul 25 11:23:00 UTC 2018 x86_64
GNU/Linux

[Bug libstdc++/86963] New: std::tuple incorrectly assigned

2018-08-15 Thread denin at mail dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86963

Bug ID: 86963
   Summary: std::tuple incorrectly assigned
   Product: gcc
   Version: 8.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: denin at mail dot ru
  Target Milestone: ---

$ cat meow.cpp 
#include 
#include 

struct S {
S =(S const &) = delete;
S =(S &&) = delete;
};
static_assert(!std::is_move_assignable_v>);

$ g++ meow.cpp 
meow.cpp:8:15: error: static assertion failed
 static_assert(!std::is_move_assignable_v>);
   ^~~~

Despite tuple's elements being not assignable at all, tuple itself is
incorrectly considered assignable, due to non-SFINAE protected operator= in
class definition. Thus, the following code breaks on 'f = std::move(g);':

template void mv_assign(T , T &) {
if constexpr(std::is_move_assignable_v>) left =
std::move(right);
}

int main() {
std::tuple f, g;
mv_assign(f, std::move(g));
}

ENVIRONMENT

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --enable-multilib --disable-werror
--enable-checking=release --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 8.1.1 20180531 (GCC) 

$ uname -a
Linux home 4.17.10-1-ARCH #1 SMP PREEMPT Wed Jul 25 11:23:00 UTC 2018 x86_64
GNU/Linux

[Bug c++/52869] [DR 1207] "this" not being allowed in noexcept clauses

2018-12-12 Thread denin at mail dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52869

--- Comment #15 from denin at mail dot ru ---
(In reply to Marek Polacek from comment #14)
> This is actually another problem, one that is tracked in PR86476.

So context closure is unduly greedy: members defined above are available while
those from below are not? Funny indeed.

[Bug c++/52869] [DR 1207] "this" not being allowed in noexcept clauses

2018-12-12 Thread denin at mail dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52869

--- Comment #16 from denin at mail dot ru ---
(In reply to Marek Polacek from comment #14)
> This is actually another problem, one that is tracked in PR86476.

Hmm.

$ cat wat.cpp 
struct Omg {
void f() {}
void g() noexcept(noexcept(f())) {}
};
$ g++ wat.cpp 
wat.cpp:3:31: error: cannot call member function ‘void Omg::f()’ without object
  void g() noexcept(noexcept(f())) {}
   ^
$ g++ -v |& grep version
gcc version 8.2.1 20181127 (GCC)