------- Comment #2 from eric dot niebler at gmail dot com  2010-03-11 11:53 
-------
You're right. Let me amend my example.

  struct S
  {
    S() = default;
    S(S const &) = default;
    S(int i) : i(i) {}
    int i;
  };

  S const s {1};

S would seem to satisfy the requirements for a trivial type now, correct? N2342
states:

"When an aggregate with static storage duration is initialized with a
brace-enclosed initializer-list, if all the member initializer expressions are
constant expressions, and the aggregate is a trivial type, the initialization
shall be done during the static phase of initialization"

GCC initializes s dynamically. That doesn't seem right. I see that constant
expressions are not yet implemented in gcc-4.5. Am I correct in assuming that
once constant expressions are implemented, this initialization will be static?


-- 


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

Reply via email to