[Bug c++/70521] New: [C++14] nonempty constexpr noexcept constructor rejected

2016-04-03 Thread meiomorphism at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70521

Bug ID: 70521
   Summary: [C++14] nonempty constexpr noexcept constructor
rejected
   Product: gcc
   Version: 5.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: meiomorphism at gmail dot com
  Target Milestone: ---

Created attachment 38170
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38170&action=edit
test case

The following code is rejected by gcc 5.2.1.


#include 

struct A
{
int v;
constexpr A() noexcept : v(3) { assert(v != 0); }
};

int main() { }




$ g++ -std=c++14 err.cpp 
err.cpp: In constructor ‘constexpr A::A()’:
err.cpp:6:53: error: member ‘A::v’ must be initialized by mem-initializer in
‘constexpr’ constructor
 constexpr A() noexcept : v(3) { assert(v != 0); }
 ^
err.cpp:5:9: note: declared here
 int v;
 ^


The mem-initializer in question is clearly present. clang 3.6.2 and 3.7.0
accept this code without diagnostics.

Removing any of "constexpr", "noexcept", or the "assert()" call results in the
code being accepted.

[Bug c++/61379] New: __attribute__((noreturn)) ignored on pure virtual member functions

2014-05-31 Thread meiomorphism at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61379

Bug ID: 61379
   Summary: __attribute__((noreturn)) ignored on pure virtual
member functions
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: meiomorphism at gmail dot com

Created attachment 32881
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32881&action=edit
test file (#include-free)

Pure-virtual member functions with __attribute__((noreturn)) attached are not
recognized as being noreturn. This can lead to spurious warnings.

Use of [[noreturn]] rather than __attribute__((noreturn)) yields the same
behavior.

Tested on both Debian wheezy's gcc 4.7.2 and a locally-compiled
officially-sourced gcc 4.9.0. The output of `g++ -v' for the latter is given
below.

To reproduce, compile the attached file with -Wall; the spurious warning
> virtual-noreturn.cpp:12:1: warning: control reaches end of non-void function 
> [-Wreturn-type]
(some context omitted) will be given.


=== BEGIN g++ -v output ===
Using built-in specs.
COLLECT_GCC=/home/user/local/gcc-4.9/bin/g++
COLLECT_LTO_WRAPPER=/home/user/local/gcc-4.9/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/user/src/gcc-4.9.0/configure
--prefix=/home/user/local/gcc-4.9
--with-local-prefix=/home/user/local/gcc-4.9-include --disable-bootstrap
--disable-multilib : (reconfigured) /home/user/src/gcc-4.9.0/configure
--prefix=/home/user/local/gcc-4.9
--with-local-prefix=/home/user/local/gcc-4.9-include --disable-bootstrap
--disable-multilib --enable-languages=c,c++
Thread model: posix
gcc version 4.9.0 (GCC) 
=== END gcc -v output ===