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

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

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Asif from comment #0)
> gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
> 
> //Below code does not compile, I am not using the copy constructor

You are using it.

, it seems
> to work fine in Vs2013, CLANG (experimental P1144), tested using
> https://godbolt.org/
> 
> 
> struct A1{
>   A1(int y){}
>   A1(const A1 &a1)=delete;
> };
> 
> int main()
> {
>     A1 a1_=6;

This is copy-initialization, see
https://en.cppreference.com/w/cpp/language/copy_initialization which explains
that the copy constructor is required to be accessible, even if the actual call
optimised away.

Your code is valid in C++17, but not C++11 or C++14.

Reply via email to