On Wed, Mar 16, 2011 at 9:32 PM, Jason Merrill <ja...@redhat.com> wrote:
> In a normal constexpr function, we treat *this as a potential constant
> expression.  But in a constexpr constructor it isn't, since we're still in
> the process of initializing the object.

Hi Jason,
I believe the patch is too strong, or am I reading it wrong?

The real problem is that the data member of the object is not initialized.
Fully constructed subobjects in constexpr constructor are still
be potential constant expressions.
For example, we should not reject

      struct S {
           int i;
           int j;
           constexpr S(int a) : i(a), j(i*i) { }
      };

-- Gaby

> +
> +struct s {
> +    constexpr s() : v(v) { }   // { dg-error "object being constructed" }
> +    char v;
> +};
> +
> +s bang;
>
>

Reply via email to