According to the working draft N3337 (the most similar draft to the published ISOC++11 standard) and cppreference.com, the answer is yes.
N3337:
Table 21 — CopyConstructible requirements (in addition to MoveConstructible) [copyconstructible] [...]
The type T satisfies CopyConstructible if
- The type T satisfies MoveConstructible, and [...]
But according to the result of compiling main.cpp with gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 and running a.out with the quoted statements in Ubuntu 14.04.3 LTS, the answer is not.
main.cpp:
#include <iostream>
#include <type_traits>
struct As
{
As()=default;
As(As&&)=delete;
As(const As&)=default;
As& operator=(As&&)=delete;
As& operator=(const As&)=delete;
~As()=default;
};
int main()
{
std::cout<<std::is_move_constructible<As>::value<<std::endl;
std::cout<<std::is_copy_constructible<As>::value<<std::endl;
return 0;
}
compiling and running from terminal:
$ g++ -std=c++11 main.cpp
$ ./a.out
the result (output):
0
1
Did I misunderstand something or is N3337 and cppreference.com wrong, or does gcc contains a bug?
Aucun commentaire:
Enregistrer un commentaire