public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49894] New: Uniform initialization in constructor (C++0x)
@ 2011-07-29  6:17 d.v.a at ngs dot ru
  2011-07-29  6:29 ` [Bug c++/49894] " d.v.a at ngs dot ru
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: d.v.a at ngs dot ru @ 2011-07-29  6:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

           Summary: Uniform initialization in constructor (C++0x)
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: d.v.a@ngs.ru


#include<pthread.h>

class cond_variable
{
    ::pthread_cond_t cond;
public:
    constexpr cond_variable() : cond(PTHREAD_COND_INITIALIZER) {}
};
int main() {}

test.cpp: In constructor 'constexpr cond_variable::cond_variable()':
test.cpp:7:84: error: could not convert '{{0, 0}, 0, "", 0}' from
'<brace-enclosed initializer list>' to 'pthread_cond_t'

Variant
constexpr cond_variable() : cond((::pthread_cond_t)PTHREAD_COND_INITIALIZER) {}
is Ok.


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

* [Bug c++/49894] Uniform initialization in constructor (C++0x)
  2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
@ 2011-07-29  6:29 ` d.v.a at ngs dot ru
  2011-07-29 10:08 ` rguenth at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: d.v.a at ngs dot ru @ 2011-07-29  6:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

--- Comment #1 from __vic <d.v.a at ngs dot ru> 2011-07-29 06:28:47 UTC ---
class mutex
{
    ::pthread_mutex_t mtx;
public:
    constexpr mutex() : mtx(PTHREAD_MUTEX_INITIALIZER) {}
};

Compiles fine... What is the difference?


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

* [Bug c++/49894] Uniform initialization in constructor (C++0x)
  2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
  2011-07-29  6:29 ` [Bug c++/49894] " d.v.a at ngs dot ru
@ 2011-07-29 10:08 ` rguenth at gcc dot gnu.org
  2011-07-29 10:13 ` d.v.a at ngs dot ru
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-29 10:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011.07.29 10:08:10
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-29 10:08:10 UTC ---
That your libc does not provide a C++ compatible initializer for
pthread_cond_t?

Without preprocessed source we can't tell.   Please attach that.


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

* [Bug c++/49894] Uniform initialization in constructor (C++0x)
  2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
  2011-07-29  6:29 ` [Bug c++/49894] " d.v.a at ngs dot ru
  2011-07-29 10:08 ` rguenth at gcc dot gnu.org
@ 2011-07-29 10:13 ` d.v.a at ngs dot ru
  2011-07-29 10:17 ` d.v.a at ngs dot ru
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: d.v.a at ngs dot ru @ 2011-07-29 10:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

--- Comment #3 from __vic <d.v.a at ngs dot ru> 2011-07-29 10:13:16 UTC ---
> test.cpp:7:84: error: could not convert '{{0, 0}, 0, "", 0}' from
> '<brace-enclosed initializer list>' to 'pthread_cond_t'
> 

Initializer is:

{{0, 0}, 0, "", 0}


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

* [Bug c++/49894] Uniform initialization in constructor (C++0x)
  2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
                   ` (2 preceding siblings ...)
  2011-07-29 10:13 ` d.v.a at ngs dot ru
@ 2011-07-29 10:17 ` d.v.a at ngs dot ru
  2011-10-14 19:29 ` [Bug libstdc++/49894] [C++0x] Uniform initialization in constructor jason at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: d.v.a at ngs dot ru @ 2011-07-29 10:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

--- Comment #4 from __vic <d.v.a at ngs dot ru> 2011-07-29 10:17:35 UTC ---
Created attachment 24861
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24861
Preprocessor output


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

* [Bug libstdc++/49894] [C++0x] Uniform initialization in constructor
  2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
                   ` (3 preceding siblings ...)
  2011-07-29 10:17 ` d.v.a at ngs dot ru
@ 2011-10-14 19:29 ` jason at gcc dot gnu.org
  2011-10-14 23:05 ` paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-14 19:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
                 CC|                            |jason at gcc dot gnu.org
          Component|c++                         |libstdc++

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-14 19:28:42 UTC ---
The request to support ({ ... }) for array mem-initializers was rejected by
core:

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#1339

Now that the compiler supports non-static data member initializers, the library
should use that instead of a mem-initializer.

  ::pthread_cond_t cond = PTHREAD_COND_INITIALIZER;

should work in all cases.


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

* [Bug libstdc++/49894] [C++0x] Uniform initialization in constructor
  2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
                   ` (4 preceding siblings ...)
  2011-10-14 19:29 ` [Bug libstdc++/49894] [C++0x] Uniform initialization in constructor jason at gcc dot gnu.org
@ 2011-10-14 23:05 ` paolo.carlini at oracle dot com
  2011-10-15 12:26 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-14 23:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jwakely.gcc at gmail dot
                   |                            |com

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-14 23:04:27 UTC ---
Jon, did you follow this?


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

* [Bug libstdc++/49894] [C++0x] Uniform initialization in constructor
  2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
                   ` (5 preceding siblings ...)
  2011-10-14 23:05 ` paolo.carlini at oracle dot com
@ 2011-10-15 12:26 ` redi at gcc dot gnu.org
  2011-10-15 12:54 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2011-10-15 12:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-10-15 12:25:41 UTC ---
Yeah, this pr inspired http://gcc.gnu.org/ml/libstdc++/2011-10/msg00016.html


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

* [Bug libstdc++/49894] [C++0x] Uniform initialization in constructor
  2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
                   ` (6 preceding siblings ...)
  2011-10-15 12:26 ` redi at gcc dot gnu.org
@ 2011-10-15 12:54 ` redi at gcc dot gnu.org
  2011-10-15 19:54 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2011-10-15 12:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |redi at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.7.0

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-10-15 12:53:47 UTC ---
I'll deal with this after PR 50196


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

* [Bug libstdc++/49894] [C++0x] Uniform initialization in constructor
  2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
                   ` (7 preceding siblings ...)
  2011-10-15 12:54 ` redi at gcc dot gnu.org
@ 2011-10-15 19:54 ` paolo.carlini at oracle dot com
  2011-10-24 23:27 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-15 19:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|jwakely.gcc at gmail dot    |
                   |com                         |

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-15 19:53:22 UTC ---
Indeed. Thanks a lot!


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

* [Bug libstdc++/49894] [C++0x] Uniform initialization in constructor
  2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
                   ` (8 preceding siblings ...)
  2011-10-15 19:54 ` paolo.carlini at oracle dot com
@ 2011-10-24 23:27 ` redi at gcc dot gnu.org
  2011-10-24 23:30 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2011-10-24 23:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-10-24 23:26:29 UTC ---
Author: redi
Date: Mon Oct 24 23:26:25 2011
New Revision: 180411

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180411
Log:
    PR libstdc++/49894
    * include/std/mutex (__mutex_base,__recursive_mutex_base): Define new
    base classes to manage construction/destruction of native mutexes,
    using NSDMI when INIT macros are defined.
    (mutex,recursive_mutex,timed_mutex,recursive_timed_mutex): Derive from
    new base classes.
    * include/std/condition_variable (condition_variable): Use NSDMI when
    INIT macro is defined. Use noexcept.
    * src/condition_variable.cc (condition_variable): Explicitly-default
    constructor/destructor when using NSDMI. Use noexcept.
    (condition_variable_any): Likewise.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/std/condition_variable
    trunk/libstdc++-v3/include/std/mutex
    trunk/libstdc++-v3/src/condition_variable.cc


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

* [Bug libstdc++/49894] [C++0x] Uniform initialization in constructor
  2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
                   ` (9 preceding siblings ...)
  2011-10-24 23:27 ` redi at gcc dot gnu.org
@ 2011-10-24 23:30 ` redi at gcc dot gnu.org
  2011-11-05 13:34 ` redi at gcc dot gnu.org
  2012-06-15  8:51 ` d.v.a at ngs dot ru
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2011-10-24 23:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-10-24 23:29:38 UTC ---
Fixed for 4.7 - mutexes and condition_variables use NSDMI to initialize the
native types when possible


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

* [Bug libstdc++/49894] [C++0x] Uniform initialization in constructor
  2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
                   ` (10 preceding siblings ...)
  2011-10-24 23:30 ` redi at gcc dot gnu.org
@ 2011-11-05 13:34 ` redi at gcc dot gnu.org
  2012-06-15  8:51 ` d.v.a at ngs dot ru
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2011-11-05 13:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-11-05 13:33:38 UTC ---
Author: redi
Date: Sat Nov  5 13:33:29 2011
New Revision: 181013

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181013
Log:
    PR libstdc++/49894
    PR bootstrap/50982
    * include/std/mutex (once_flag): Use NSDMI.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/std/mutex


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

* [Bug libstdc++/49894] [C++0x] Uniform initialization in constructor
  2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
                   ` (11 preceding siblings ...)
  2011-11-05 13:34 ` redi at gcc dot gnu.org
@ 2012-06-15  8:51 ` d.v.a at ngs dot ru
  12 siblings, 0 replies; 14+ messages in thread
From: d.v.a at ngs dot ru @ 2012-06-15  8:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49894

__vic <d.v.a at ngs dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

--- Comment #13 from __vic <d.v.a at ngs dot ru> 2012-06-15 08:51:36 UTC ---
NSDMI works fine. Thanx


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

end of thread, other threads:[~2012-06-15  8:51 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-29  6:17 [Bug c++/49894] New: Uniform initialization in constructor (C++0x) d.v.a at ngs dot ru
2011-07-29  6:29 ` [Bug c++/49894] " d.v.a at ngs dot ru
2011-07-29 10:08 ` rguenth at gcc dot gnu.org
2011-07-29 10:13 ` d.v.a at ngs dot ru
2011-07-29 10:17 ` d.v.a at ngs dot ru
2011-10-14 19:29 ` [Bug libstdc++/49894] [C++0x] Uniform initialization in constructor jason at gcc dot gnu.org
2011-10-14 23:05 ` paolo.carlini at oracle dot com
2011-10-15 12:26 ` redi at gcc dot gnu.org
2011-10-15 12:54 ` redi at gcc dot gnu.org
2011-10-15 19:54 ` paolo.carlini at oracle dot com
2011-10-24 23:27 ` redi at gcc dot gnu.org
2011-10-24 23:30 ` redi at gcc dot gnu.org
2011-11-05 13:34 ` redi at gcc dot gnu.org
2012-06-15  8:51 ` d.v.a at ngs dot ru

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).