This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/53734] New: std::is_constructible fails to compile if copy constructor is private
- From: "maxdebayser at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 20 Jun 2012 18:47:44 +0000
- Subject: [Bug libstdc++/53734] New: std::is_constructible fails to compile if copy constructor is private
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53734
Bug #: 53734
Summary: std::is_constructible fails to compile if copy
constructor is private
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: maxdebayser@gmail.com
Created attachment 27666
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27666
Test case with a class with a private copy constructor
Given a class Foo with a private copy constructor, std::is_constructible<Foo,
Foo>::value or std::is_copy_constructible<Foo>::value fail to compile.
Shouldn't this expression successfully compile and result in 0? It works this
way in clang++.
I've attached a test case. The command line used to compile was g++ -std=c++11
test.cpp. The error message is:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:
In instantiation of âstruct std::__is_direct_constructible_impl<NoCopy,
NoCopy>â:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:116:12:
required from âstruct std::__and_<std::is_destructible<NoCopy>,
std::__is_direct_constructible_impl<NoCopy, NoCopy> >â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:778:12:
required from âstruct std::__is_direct_constructible_new_safe<NoCopy,
NoCopy>â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:856:12:
required from âstruct std::__is_direct_constructible_new<NoCopy, NoCopy>â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:864:12:
required from âstruct std::__is_direct_constructible<NoCopy, NoCopy>â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:905:12:
required from âstruct std::__is_constructible_impl<NoCopy, NoCopy>â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:916:12:
required from âstruct std::is_constructible<NoCopy, NoCopy>â
test.cpp:13:95: required from here
test.cpp:7:2: error: âNoCopy::NoCopy(const NoCopy&)â is private
In file included from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/move.h:57:0,
from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/stl_pair.h:61,
from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/stl_algobase.h:65,
from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/char_traits.h:41,
from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ios:41,
from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ostream:40,
from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/iostream:40,
from test.cpp:1:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:762:43:
error: within this context
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:
In instantiation of âstruct std::__is_direct_constructible_impl<NoCopy, const
NoCopy&>â:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:116:12:
required from âstruct std::__and_<std::is_destructible<NoCopy>,
std::__is_direct_constructible_impl<NoCopy, const NoCopy&> >â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:778:12:
required from âstruct std::__is_direct_constructible_new_safe<NoCopy, const
NoCopy&>â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:856:12:
required from âstruct std::__is_direct_constructible_new<NoCopy, const
NoCopy&>â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:864:12:
required from âstruct std::__is_direct_constructible<NoCopy, const NoCopy&>â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:905:12:
required from âstruct std::__is_constructible_impl<NoCopy, const NoCopy&>â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:916:12:
required from âstruct std::is_constructible<NoCopy, const NoCopy&>â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:929:12:
required from âstruct std::__is_copy_constructible_impl<NoCopy, false>â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:935:12:
required from âstruct std::is_copy_constructible<NoCopy>â
test.cpp:14:85: required from here
test.cpp:7:2: error: âNoCopy::NoCopy(const NoCopy&)â is private
In file included from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/move.h:57:0,
from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/stl_pair.h:61,
from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/stl_algobase.h:65,
from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/char_traits.h:41,
from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ios:41,
from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ostream:40,
from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/iostream:40,
from test.cpp:1:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/type_traits:762:43:
error: within this context