[Bug libstdc++/53734] New: std::is_constructible fails to compile if copy constructor is private
maxdebayser at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 20 18:48:00 GMT 2012
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
More information about the Gcc-bugs
mailing list