[Bug c++/97055] New: Copy and move constructors shadowed by templatized constructor

amir.ahmed.ansari at outlook dot com gcc-bugzilla@gcc.gnu.org
Tue Sep 15 05:26:36 GMT 2020


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

            Bug ID: 97055
           Summary: Copy and move constructors shadowed by templatized
                    constructor
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amir.ahmed.ansari at outlook dot com
  Target Milestone: ---

Created attachment 49219
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49219&action=edit
Failing program

The attached simple program fails to compile on GCC 10.2. It compiles on both
clang 10.0.1 and MSVC 19.24. The error produced on godbolt.org with no
compilation options given:

<source>: In function 'int main()':

<source>:20:43: error: use of deleted function 'C::C(const U&) [with U =
std::vector<C>]'

   20 |     auto v2 = std::vector<C>{std::move(v1)};

      |                                           ^

<source>:14:5: note: declared here

   14 |     C(const U&) = delete;

      |     ^

<source>:21:32: error: use of deleted function 'C::C(const U&) [with U =
std::vector<C>]'

   21 |     auto v3 = std::vector<C>{v1};

      |                                ^

<source>:14:5: note: declared here

   14 |     C(const U&) = delete;

      |     ^

Compiler returned: 1


More information about the Gcc-bugs mailing list