http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55335



             Bug #: 55335

           Summary: [DR 5] cv-qualifiers of destination type in

                    copy-initialization

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: ai.az...@gmail.com





Created attachment 28694

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28694

Output of -v option and preprocessed file with GCC 4.8.0 20121111



The following valid code is rejected by GCC 4.6.4 20121109, 4.7.3 20121110 and

4.8.0 20121111.



/////////////////////////

struct C{};



struct A {

  A(const A&){};

  A(const C&){};

};



int main()

{

  C c;

  const volatile A a = c;

}

/////////////////////////



For the above code, GCC 4.8.0 20121111 complains as follows;



main.cpp: In function 'int main()':

main.cpp:11:24: error: no matching function for call to 'A::A(const volatile

A)'

   const volatile A a = c;

                        ^

main.cpp:11:24: note: candidates are:

main.cpp:5:3: note: A::A(const C&)

   A(const C&){};

   ^

main.cpp:5:3: note:   no known conversion for argument 1 from 'const volatile

A' to 'const C&'

main.cpp:4:3: note: A::A(const A&)

   A(const A&){};

   ^

main.cpp:4:3: note:   no known conversion for argument 1 from 'const volatile

A' to 'const A&'



As far as I can guess from the error message, GCC does not seem to implement

the proposed resolution of DR 5.

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#5

Reply via email to