public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56319] New: call to implicitly-deleted copy constructor accepted
@ 2013-02-14 12:06 wlodzimierz.lipert at gmail dot com
2013-02-14 12:32 ` [Bug c++/56319] implicit copy constructor is not deleted when it is ill formed redi at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: wlodzimierz.lipert at gmail dot com @ 2013-02-14 12:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56319
Bug #: 56319
Summary: call to implicitly-deleted copy constructor accepted
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: wlodzimierz.lipert@gmail.com
Hi,
GCC compiles following code. Copying of tuple of rvalues returned by:
std::forward_as_tuple, should not be allowed because it is ill formed.
(clang++ properly detects the problem and report an error.)
/*----------------------------------------------------------------------------*/
template <unsigned int ...>
struct TupleIndices
{};
template<
unsigned int I,
typename IndexTuple,
typename... Types>
struct MakeTupleIndices_;
template<
unsigned int I,
unsigned int... Indices,
typename T,
typename... Types>
struct MakeTupleIndices_<I, TupleIndices<Indices...>, T, Types...>
{
typedef typename MakeTupleIndices_<I + 1, TupleIndices<Indices..., I>,
Types...>::type type;
};
template<
unsigned int I,
unsigned int... Indices>
struct MakeTupleIndices_<I, TupleIndices<Indices...> >
{
typedef TupleIndices<Indices...> type;
};
template<typename... Types>
struct MakeTupleIndices : public MakeTupleIndices_<0, TupleIndices<>, Types...>
{};
/*----------------------------------------------------------------------------*/
void bar(int)
{
}
template <typename... Args, unsigned int... ArgsIndices>
void fooImpl(std::tuple<Args...> args, TupleIndices<ArgsIndices...>)
{
bar(std::forward<Args>(std::get<ArgsIndices>(args))...);
}
template <typename... Args>
void foo(std::tuple<Args...> args)
{
fooImpl(args, typename MakeTupleIndices<Args...>::type());
}
/*----------------------------------------------------------------------------*/
enum
{
id = 1
};
int main()
{
foo(std::forward_as_tuple(id));
return 0;
}
/*----------------------------------------------------------------------------*/
Wlodzimierz.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/56319] implicit copy constructor is not deleted when it is ill formed
2013-02-14 12:06 [Bug c++/56319] New: call to implicitly-deleted copy constructor accepted wlodzimierz.lipert at gmail dot com
@ 2013-02-14 12:32 ` redi at gcc dot gnu.org
2013-02-14 12:37 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2013-02-14 12:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56319
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|major |normal
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-14 12:32:31 UTC ---
reduced:
#include <tuple>
template <typename... Args>
void fooImpl(std::tuple<Args...> args)
{
}
template <typename... Args>
void foo(std::tuple<Args...> args)
{
fooImpl(args);
}
enum E { id };
int main()
{
foo(std::forward_as_tuple(id));
return 0;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/56319] implicit copy constructor is not deleted when it is ill formed
2013-02-14 12:06 [Bug c++/56319] New: call to implicitly-deleted copy constructor accepted wlodzimierz.lipert at gmail dot com
2013-02-14 12:32 ` [Bug c++/56319] implicit copy constructor is not deleted when it is ill formed redi at gcc dot gnu.org
@ 2013-02-14 12:37 ` redi at gcc dot gnu.org
2013-02-14 12:45 ` [Bug c++/56319] [DR 1051] implicit copy constructor is not deleted for type with rvalue reference member redi at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2013-02-14 12:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56319
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-14 12:36:56 UTC ---
Reduced to remove <tuple> dependency
template<typename T>
struct tuple
{
T t;
};
template<class... Types>
tuple<Types&&...> forward_as_tuple(Types&&... t) noexcept
{
return tuple<Types&&...>{ static_cast<Types&&>(t)... };
}
template <typename... Args>
void fooImpl(tuple<Args...> args)
{
}
template <typename... Args>
void foo(tuple<Args...> args)
{
fooImpl(args);
}
enum E { id };
int main()
{
foo(forward_as_tuple(id));
return 0;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/56319] [DR 1051] implicit copy constructor is not deleted for type with rvalue reference member
2013-02-14 12:06 [Bug c++/56319] New: call to implicitly-deleted copy constructor accepted wlodzimierz.lipert at gmail dot com
2013-02-14 12:32 ` [Bug c++/56319] implicit copy constructor is not deleted when it is ill formed redi at gcc dot gnu.org
2013-02-14 12:37 ` redi at gcc dot gnu.org
@ 2013-02-14 12:45 ` redi at gcc dot gnu.org
2013-02-14 20:37 ` daniel.kruegler at googlemail dot com
2013-02-14 20:47 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2013-02-14 12:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56319
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-02-14
Summary|implicit copy constructor |[DR 1051] implicit copy
|is not deleted when it is |constructor is not deleted
|ill formed |for type with rvalue
| |reference member
Ever Confirmed|0 |1
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-14 12:45:16 UTC ---
And a minimal form:
struct T { int&& i; };
T t { 1 };
T tt = t;
This should be rejected by [class.copy]/11, this was DR 1051
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1051
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/56319] [DR 1051] implicit copy constructor is not deleted for type with rvalue reference member
2013-02-14 12:06 [Bug c++/56319] New: call to implicitly-deleted copy constructor accepted wlodzimierz.lipert at gmail dot com
` (2 preceding siblings ...)
2013-02-14 12:45 ` [Bug c++/56319] [DR 1051] implicit copy constructor is not deleted for type with rvalue reference member redi at gcc dot gnu.org
@ 2013-02-14 20:37 ` daniel.kruegler at googlemail dot com
2013-02-14 20:47 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-02-14 20:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56319
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler at
| |googlemail dot com
--- Comment #4 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-02-14 20:36:52 UTC ---
Seems to be a dup of bug 55017
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/56319] [DR 1051] implicit copy constructor is not deleted for type with rvalue reference member
2013-02-14 12:06 [Bug c++/56319] New: call to implicitly-deleted copy constructor accepted wlodzimierz.lipert at gmail dot com
` (3 preceding siblings ...)
2013-02-14 20:37 ` daniel.kruegler at googlemail dot com
@ 2013-02-14 20:47 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2013-02-14 20:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56319
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-14 20:47:27 UTC ---
Thanks, Daniel
*** This bug has been marked as a duplicate of bug 55017 ***
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-02-14 20:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-14 12:06 [Bug c++/56319] New: call to implicitly-deleted copy constructor accepted wlodzimierz.lipert at gmail dot com
2013-02-14 12:32 ` [Bug c++/56319] implicit copy constructor is not deleted when it is ill formed redi at gcc dot gnu.org
2013-02-14 12:37 ` redi at gcc dot gnu.org
2013-02-14 12:45 ` [Bug c++/56319] [DR 1051] implicit copy constructor is not deleted for type with rvalue reference member redi at gcc dot gnu.org
2013-02-14 20:37 ` daniel.kruegler at googlemail dot com
2013-02-14 20:47 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).