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

            Bug ID: 106166
           Summary: Improve diagnostic for explicit constructor
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

This is not valid code:

struct E { explicit E(int); };
void
g ()
{
  E e = 1; // error
}

but we only say
q1.C:5:9: error: conversion from ‘int’ to non-scalar type ‘E’ requested
    5 |   E e = 1; // error

It would be nice to explain that an explicit constructor is not a candidate in
copy-initialization context.

Reply via email to