https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113007

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
#include <variant>

int main()
{
  int i = 42;
  std::monostate x_0[] = { i };
  bool x_1[] = { i };
  long long x_2[] = { i };
  double x_3[] = { i };
}

var.cc: In function ‘int main()’:
var.cc:6:30: error: initializer for ‘std::monostate’ must be brace-enclosed
    6 |   std::monostate x_0[] = { i };
      |                              ^
var.cc:7:18: warning: narrowing conversion of ‘i’ from ‘int’ to ‘bool’
[-Wnarrowing]
    7 |   bool x_1[] = { i };
      |                  ^
var.cc:9:20: warning: narrowing conversion of ‘i’ from ‘int’ to ‘double’
[-Wnarrowing]
    9 |   double x_3[] = { i };
      |                    ^

Narrowing conversions are hard errors in SFINAE contexts, even though they're
just a warning in other contexts.

Only x_2 is well-formed, and so the overload set is just F(int64_t).

Reply via email to