C++ Logo

std-discussion

Advanced search

Value initialization of class with list initialization, explicit ctors

From: Johannes Schaub <schaub.johannes_at_[hidden]>
Date: Fri, 9 Feb 2024 14:01:32 +0100
According to what I read on the Eelis draft, the following should resolve
to the nonexplicit ctor (consistency gone, since it is different for non
default ctors... what is the reason for this inconsistency?).

But GCC and Clang raise an ambiguity. Why do they? This seems like a simple
example.

struct A {
  explicit A() { }
  A(int = 0) { }
};

A a = {};

Received on 2024-02-09 13:01:45