GCC 7 needs temporary for brace-initializing (non-literal-type) member variable?

2017-10-06 Thread Titus Von Boxberg
Hello,

this sample fails to compile with gcc 7.1 and 7.2

--
class A {
private:
public:
  constexpr A() {}
  ~A() {}
};

class B {
private:
  A  a;
public:
  constexpr B() : a{} {}
// works also with g++ -std=c++17:
// constexpr B() : a() {}

  ~B() {}
};
--
with
error: temporary of non-literal type ‘A’ in a constant expression
note:   ‘A’ has a non-trivial destructor

BUT ONLY when compiled with -std=c++17
With -std=c++11 and 14 g++ accepts this code.
g++ -std=c++17 accepts the code when replacing the brace-initialization
of B::a by parentheses ()


The unmodified code also compiles fine e.g. with MS cl.exe 19.11 and clang 5.0 
-std=c++1{147}

Did I overlook something?
Or should I file a bug? Or is there already one I could not find?

Thanks already for any insight!
Regards,
Titus


Re: GCC 7 needs temporary for brace-initializing (non-literal-type) member variable?

2017-10-06 Thread Jonathan Wakely
On 6 October 2017 at 21:51, Titus Von Boxberg wrote:
> Or should I file a bug? Or is there already one I could not find?

This mailing list is not for "is this a bug?" questions. This looks
like a bug, so please create a bug report in Bugzilla, thanks.