public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66360] New: thread_local variable needs copy constructor
@ 2015-06-01 12:40 programmerjake at gmail dot com
  2015-06-01 13:30 ` [Bug c++/66360] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: programmerjake at gmail dot com @ 2015-06-01 12:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66360

            Bug ID: 66360
           Summary: thread_local variable needs copy constructor
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: programmerjake at gmail dot com
  Target Milestone: ---

Created attachment 35663
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35663&action=edit
source code

thread_local variable won't compile when trying to forward empty argument list
to member variable where the member variable has deleted copy/move
constructors.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/66360] thread_local variable needs copy constructor
  2015-06-01 12:40 [Bug c++/66360] New: thread_local variable needs copy constructor programmerjake at gmail dot com
@ 2015-06-01 13:30 ` pinskia at gcc dot gnu.org
  2015-06-01 14:17 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-06-01 13:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66360

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This has nothing to do with thread_local.  That is removing static thread_local
still causes it to produce an error.


Here is a more reduced testcase:
template <typename T>
struct wrapper final
{
  T value;
  template <typename ...Args>
  wrapper(Args &&...args)
    : value(args...)
  {
  }
};

struct non_copyable
{
  non_copyable(const non_copyable &) = delete;
  non_copyable();
  ~non_copyable();
};

template <typename T>
class thread_local_variable final
{
private:
  wrapper<T> *pointer;
public:
  template <typename ...Args>
  thread_local_variable(Args &&...args)
  {
    wrapper<T> v(args...);
    pointer = &v;
  }
  T &get()
  {
    return pointer->value;
  }
};

non_copyable &fn()
{
  thread_local_variable<non_copyable> v;
  return v.get();
}


--- CUT ----
args here is {}.  I suspect an empty arguments it not being treated correctly.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/66360] thread_local variable needs copy constructor
  2015-06-01 12:40 [Bug c++/66360] New: thread_local variable needs copy constructor programmerjake at gmail dot com
  2015-06-01 13:30 ` [Bug c++/66360] " pinskia at gcc dot gnu.org
@ 2015-06-01 14:17 ` redi at gcc dot gnu.org
  2020-08-30 18:17 ` egallager at gcc dot gnu.org
  2020-11-04 15:10 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2015-06-01 14:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66360

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-06-01
     Ever confirmed|0                           |1

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
struct non_copyable
{
  non_copyable(const non_copyable &) = delete;
  non_copyable();
};

struct wrapper
{
  non_copyable value;

  template <typename ...Args>
  wrapper(Args &&... args)
    : value(args...)
  {
  }
};

struct V
{
  template <typename ...Args>
  V(Args &&... args)
  {
    wrapper v(args...);
  }
};

V v;


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/66360] thread_local variable needs copy constructor
  2015-06-01 12:40 [Bug c++/66360] New: thread_local variable needs copy constructor programmerjake at gmail dot com
  2015-06-01 13:30 ` [Bug c++/66360] " pinskia at gcc dot gnu.org
  2015-06-01 14:17 ` redi at gcc dot gnu.org
@ 2020-08-30 18:17 ` egallager at gcc dot gnu.org
  2020-11-04 15:10 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: egallager at gcc dot gnu.org @ 2020-08-30 18:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66360

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org

--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> This has nothing to do with thread_local.  That is removing static
> thread_local still causes it to produce an error.
> 

OK so how would you suggest retitling this, then?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/66360] thread_local variable needs copy constructor
  2015-06-01 12:40 [Bug c++/66360] New: thread_local variable needs copy constructor programmerjake at gmail dot com
                   ` (2 preceding siblings ...)
  2020-08-30 18:17 ` egallager at gcc dot gnu.org
@ 2020-11-04 15:10 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-04 15:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66360

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |7.0
             Blocks|59994                       |
             Status|NEW                         |RESOLVED

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for GCC 7 by r246953 (which has a similar testcase already).


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59994
[Bug 59994] [meta-bug] thread_local

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-04 15:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-01 12:40 [Bug c++/66360] New: thread_local variable needs copy constructor programmerjake at gmail dot com
2015-06-01 13:30 ` [Bug c++/66360] " pinskia at gcc dot gnu.org
2015-06-01 14:17 ` redi at gcc dot gnu.org
2020-08-30 18:17 ` egallager at gcc dot gnu.org
2020-11-04 15:10 ` 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).