public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type
@ 2011-08-08 20:56 akrzemi1 at gmail dot com
  2011-08-08 22:29 ` [Bug c++/50025] " redi at gcc dot gnu.org
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: akrzemi1 at gmail dot com @ 2011-08-08 20:56 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: C++0x initialization syntax doesn't work for class
                    members of reference type
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: akrzemi1@gmail.com


The following code does not compile although I expect it to:

/// BEGIN CODE ///
#include <utility>

struct S {};

struct C {
  S &  mc2;
  S && mc3;
  C( S& b, S && c ) :  mc2{b}, mc3{std::move(c)} {}
};

int main() { return 0; }
/// END CODE ///

I compile it with command:
g++ test.cpp -std=c++0x -o test.exe

The output is:
test.cpp: In constructor ‘C::C(S&, S&&)’:
test.cpp:9:48: error: invalid initialization of non-const reference of type
‘S&’ from an rvalue of type ‘<brace-enclosed initializer list>’
test.cpp:9:48: error: invalid initialization of reference of type ‘S&&’ from
expression of type ‘<brace-enclosed initializer list>’

Compiler version (g++ -v):
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-redhat-linux/4.6.0/lto-wrapper
Target: i686-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch=i686
--build=i686-redhat-linux
Thread model: posix
gcc version 4.6.0 20110428 (Red Hat 4.6.0-6) (GCC)


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

* [Bug c++/50025] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
@ 2011-08-08 22:29 ` redi at gcc dot gnu.org
  2011-08-08 22:47 ` redi at gcc dot gnu.org
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: redi at gcc dot gnu.org @ 2011-08-08 22:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-08-08 22:29:08 UTC ---
G++ is actually correct according to wording in the C++11 FDIS (see 8.5.4
paragraphs 5 and 6), but we've reported it as an issue that needs to be fixed.


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

* [Bug c++/50025] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
  2011-08-08 22:29 ` [Bug c++/50025] " redi at gcc dot gnu.org
@ 2011-08-08 22:47 ` redi at gcc dot gnu.org
  2011-08-08 23:31 ` akrzemi1 at gmail dot com
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: redi at gcc dot gnu.org @ 2011-08-08 22:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-08-08 22:46:31 UTC ---
It's not just class members, it applies to list-initialization of any reference
type:

  int i;
  int& ir{ i }; 

The FDIS requires a temporary to be created, and a non-const reference cannot
bind to a temporary.


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

* [Bug c++/50025] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
  2011-08-08 22:29 ` [Bug c++/50025] " redi at gcc dot gnu.org
  2011-08-08 22:47 ` redi at gcc dot gnu.org
@ 2011-08-08 23:31 ` akrzemi1 at gmail dot com
  2011-08-16 16:44 ` redi at gcc dot gnu.org
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: akrzemi1 at gmail dot com @ 2011-08-08 23:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrzej Krzemienski <akrzemi1 at gmail dot com> 2011-08-08 23:31:37 UTC ---
(In reply to comment #1)
> G++ is actually correct according to wording in the C++11 FDIS (see 8.5.4
> paragraphs 5 and 6), but we've reported it as an issue that needs to be fixed.

Are you sure about the paragraphs 5 and 6? (5 starts with "An object of type",
6 starts with "The lifetime of the array"?) They only say how
std::initializer_list is created and how it behaves, but the 6th bullet of
paragraph 3 (the one starting with "Otherwise, if the initializer list has a
single element") does not require that std::initializer_list is created or
used. It simply says that in code like:
  int i = 0;
  int & ri{i};

"ri" is initialized with "i". (And BTW, this example works on the same
compiler.)


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

* [Bug c++/50025] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (2 preceding siblings ...)
  2011-08-08 23:31 ` akrzemi1 at gmail dot com
@ 2011-08-16 16:44 ` redi at gcc dot gnu.org
  2011-10-26 10:34 ` paolo.carlini at oracle dot com
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: redi at gcc dot gnu.org @ 2011-08-16 16:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-08-16 16:21:37 UTC ---
sorry, I meant bullets 5 and 6 in paragraph 3

the 5th bullet applies before the 6th one, and that says for a reference type a
temporary is created. The 6th bullet is never reached for references.
Your example with int& works because GCC doesn't implement the FDIS wording
yet, according to the FDIS it should be rejected too, see
http://gcc.gnu.org/ml/gcc-help/2011-07/msg00053.html

this is a wording problem in the FDIS and will be core issue 1288 in the next
issues list


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

* [Bug c++/50025] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (3 preceding siblings ...)
  2011-08-16 16:44 ` redi at gcc dot gnu.org
@ 2011-10-26 10:34 ` paolo.carlini at oracle dot com
  2011-10-26 10:45 ` daniel.kruegler at googlemail dot com
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-26 10:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-26 10:33:45 UTC ---
Does anybody know the DR #? We could add it to the description and suspend.


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

* [Bug c++/50025] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (4 preceding siblings ...)
  2011-10-26 10:34 ` paolo.carlini at oracle dot com
@ 2011-10-26 10:45 ` daniel.kruegler at googlemail dot com
  2011-10-26 10:59 ` [Bug c++/50025] [DR 1288] " redi at gcc dot gnu.org
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-10-26 10:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2011-10-26 10:44:55 UTC ---
The corresponding CWG issue is

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1288


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (5 preceding siblings ...)
  2011-10-26 10:45 ` daniel.kruegler at googlemail dot com
@ 2011-10-26 10:59 ` redi at gcc dot gnu.org
  2012-04-14  7:07 ` marc.glisse at normalesup dot org
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: redi at gcc dot gnu.org @ 2011-10-26 10:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |SUSPENDED
   Last reconfirmed|                            |2011-10-26
            Summary|C++0x initialization syntax |[DR 1288] C++0x
                   |doesn't work for class      |initialization syntax
                   |members of reference type   |doesn't work for class
                   |                            |members of reference type
     Ever Confirmed|0                           |1


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (6 preceding siblings ...)
  2011-10-26 10:59 ` [Bug c++/50025] [DR 1288] " redi at gcc dot gnu.org
@ 2012-04-14  7:07 ` marc.glisse at normalesup dot org
  2012-04-14 11:02 ` redi at gcc dot gnu.org
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: marc.glisse at normalesup dot org @ 2012-04-14  7:07 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <marc.glisse at normalesup dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marc.glisse at normalesup
                   |                            |dot org

--- Comment #7 from Marc Glisse <marc.glisse at normalesup dot org> 2012-04-14 07:07:05 UTC ---
Link changed now that it has been voted into the working paper:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1288

should it be un-suspended?


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (7 preceding siblings ...)
  2012-04-14  7:07 ` marc.glisse at normalesup dot org
@ 2012-04-14 11:02 ` redi at gcc dot gnu.org
  2012-09-13 12:45 ` temp78593 at mutluit dot com
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-14 11:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |NEW

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-14 11:01:59 UTC ---
Yep, thanks, Marc.


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (8 preceding siblings ...)
  2012-04-14 11:02 ` redi at gcc dot gnu.org
@ 2012-09-13 12:45 ` temp78593 at mutluit dot com
  2012-09-30 10:58 ` redi at gcc dot gnu.org
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: temp78593 at mutluit dot com @ 2012-09-13 12:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Uenal Mutlu <temp78593 at mutluit dot com> 2012-09-13 12:44:44 UTC ---
Created attachment 28188
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28188
Testcase for Bug "error: invalid initialization of non-const reference of type
‘std::istream&"

Mysterious compiler error in line 35 of the attached testcase (test1.cpp);
marked there as "BUG":

test1.cpp:35:45: error: invalid initialization of non-const reference of type
‘std::istream& {aka std::basic_istream<char>&}’ from an rvalue of type ‘void*’


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (9 preceding siblings ...)
  2012-09-13 12:45 ` temp78593 at mutluit dot com
@ 2012-09-30 10:58 ` redi at gcc dot gnu.org
  2013-01-18 15:35 ` redi at gcc dot gnu.org
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: redi at gcc dot gnu.org @ 2012-09-30 10:58 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #28188|0                           |1
        is obsolete|                            |

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-09-30 10:58:18 UTC ---
Comment on attachment 28188
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28188
Testcase for Bug "error: invalid initialization of non-const reference of type
‘std::istream&"

(In reply to comment #9)
> Created attachment 28188 [details]
> Testcase for Bug "error: invalid initialization of non-const reference of type
> ‘std::istream&"
> 
> Mysterious compiler error in line 35 of the attached testcase (test1.cpp);
> marked there as "BUG":
> 
> test1.cpp:35:45: error: invalid initialization of non-const reference of type
> ‘std::istream& {aka std::basic_istream<char>&}’ from an rvalue of type ‘void*’

That's not mysterious, and is not related to this bug report.

Your code can be reduced to:

struct Base {
  operator void*() { return 0; }
};
struct Derived1 : Base { };
struct Derived2 : Base { };

Derived1 d1;
Derived2 d2;

Base& b = true ? d1 : d2;

The conditional expression cannot implicitly convert two objects of different
types to a common base class, so instead the conversion operator is used to
convert both types to void*

To force the behaviour you expect use an explicit cast on one operand:

istream& si = sfile.is_open() ? (std::istream&)sfile : sbuf;


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (10 preceding siblings ...)
  2012-09-30 10:58 ` redi at gcc dot gnu.org
@ 2013-01-18 15:35 ` redi at gcc dot gnu.org
  2013-01-19 20:42 ` redi at gcc dot gnu.org
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: redi at gcc dot gnu.org @ 2013-01-18 15:35 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xazax.hun at gmail dot com

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-18 15:35:20 UTC ---
*** Bug 56032 has been marked as a duplicate of this bug. ***


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (11 preceding siblings ...)
  2013-01-18 15:35 ` redi at gcc dot gnu.org
@ 2013-01-19 20:42 ` redi at gcc dot gnu.org
  2013-11-03 12:22 ` paolo.carlini at oracle dot com
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: redi at gcc dot gnu.org @ 2013-01-19 20:42 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-19 20:42:14 UTC ---
Jason, I'd like to try and fix this, but need some clues.

A minimal example that fails to compile is:

  struct S { } s;
  S& r{s};

I find that in call.c:reference_binding we get compatible_p = false, which
seems to be wrong. Even if compatible_p is true we don't take the branch that
looks like it should be used:

  /* Directly bind reference when target expression's type is compatible with
     the reference and expression is an lvalue. In DR391, the wording in
     [8.5.3/5 dcl.init.ref] is changed to also require direct bindings for
     const and rvalue references to rvalues of compatible class type.
     We should also do direct bindings for non-class xvalues.  */
  if (compatible_p
      && (is_lvalue
      || (((CP_TYPE_CONST_NON_VOLATILE_P (to)
        && !(flags & LOOKUP_NO_RVAL_BIND))
           || TYPE_REF_IS_RVALUE (rto))
          && (gl_kind
          || (!(flags & LOOKUP_NO_TEMP_BIND)
              && (CLASS_TYPE_P (from)
              || TREE_CODE (from) == ARRAY_TYPE))))))

Naively I would expect compatible_p and is_lvalue to be true for the case
above. Does the code earlier in the function need to be adjusted for the case
where a braced-init-list has a single element of reference-compatible lvalue
type?


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (12 preceding siblings ...)
  2013-01-19 20:42 ` redi at gcc dot gnu.org
@ 2013-11-03 12:22 ` paolo.carlini at oracle dot com
  2014-03-01 11:22 ` ville.voutilainen at gmail dot com
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-11-03 12:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |drtwox at gmail dot com

--- Comment #13 from Paolo Carlini <paolo.carlini at oracle dot com> ---
*** Bug 58977 has been marked as a duplicate of this bug. ***


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (13 preceding siblings ...)
  2013-11-03 12:22 ` paolo.carlini at oracle dot com
@ 2014-03-01 11:22 ` ville.voutilainen at gmail dot com
  2014-03-01 16:52 ` 3dw4rd at verizon dot net
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-03-01 11:22 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ville.voutilainen at gmail dot com

--- Comment #14 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
This bug seems to be fixed with the current trunk. Both the example
in the original report and similar examples compile correctly, like

std::string& f() {static std::string s; return s;}
int main()
{
    std::string& ri{f()};
}

and

int& f() {static int i = 42; return i;}


int main()
{
    int& ri{f()};
}

Please close as resolved.


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (14 preceding siblings ...)
  2014-03-01 11:22 ` ville.voutilainen at gmail dot com
@ 2014-03-01 16:52 ` 3dw4rd at verizon dot net
  2014-03-01 16:54 ` 3dw4rd at verizon dot net
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: 3dw4rd at verizon dot net @ 2014-03-01 16:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Ed Smith-Rowland <3dw4rd at verizon dot net> ---
I agree.  My examples are working.

Unfortunately, my account seems to not have the permissions to close a bug.  I
am a maintainer.

Any ideas how I can get such permissions set?


Now if only I can remember what libstdc++ ctor I had to have one paren init
amongst all the other brace inits that annoyed me enough to post this error!
;-)


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (15 preceding siblings ...)
  2014-03-01 16:52 ` 3dw4rd at verizon dot net
@ 2014-03-01 16:54 ` 3dw4rd at verizon dot net
  2014-03-01 17:01 ` glisse at gcc dot gnu.org
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: 3dw4rd at verizon dot net @ 2014-03-01 16:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Ed Smith-Rowland <3dw4rd at verizon dot net> ---
Sorry for the noise.  I reported a dupe not this bug.

My question on permissions still stands though.


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (16 preceding siblings ...)
  2014-03-01 16:54 ` 3dw4rd at verizon dot net
@ 2014-03-01 17:01 ` glisse at gcc dot gnu.org
  2014-03-01 21:00 ` emsr at gcc dot gnu.org
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-03-01 17:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Ed Smith-Rowland from comment #15)
> Unfortunately, my account seems to not have the permissions to close a bug. 
> I am a maintainer.
> 
> Any ideas how I can get such permissions set?

You need to log in with an @gcc.gnu.org email address.


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (17 preceding siblings ...)
  2014-03-01 17:01 ` glisse at gcc dot gnu.org
@ 2014-03-01 21:00 ` emsr at gcc dot gnu.org
  2014-03-01 21:11 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-03-01 21:00 UTC (permalink / raw)
  To: gcc-bugs

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

emsr at gcc dot gnu.org changed:

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

--- Comment #18 from emsr at gcc dot gnu.org ---
Created attachment 32240
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32240&action=edit
This is a test case for c++/50025.

This just has simple classes with various reference member and verifies that
using brace-initialization is accepted.  I put it under g++.dg/cpp0x.

Would anyone like more test cases?

If this passes on x86_64-linux I think I'll close this with the test case
patch.

OK?


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (18 preceding siblings ...)
  2014-03-01 21:00 ` emsr at gcc dot gnu.org
@ 2014-03-01 21:11 ` jason at gcc dot gnu.org
  2014-03-01 22:52 ` emsr at gcc dot gnu.org
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: jason at gcc dot gnu.org @ 2014-03-01 21:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Jason Merrill <jason at gcc dot gnu.org> ---
Sounds good.


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (19 preceding siblings ...)
  2014-03-01 21:11 ` jason at gcc dot gnu.org
@ 2014-03-01 22:52 ` emsr at gcc dot gnu.org
  2014-03-01 22:57 ` emsr at gcc dot gnu.org
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-03-01 22:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from emsr at gcc dot gnu.org ---
Author: emsr
Date: Sat Mar  1 22:51:25 2014
New Revision: 208251

URL: http://gcc.gnu.org/viewcvs?rev=208251&root=gcc&view=rev
Log:
2014-03-01  Edward Smith-Rowland  <3dw4rd@verizon.net>

    PR c++/50025
    * g++.dg/cpp0x/pr50025.C: New.


Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/pr50025.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (20 preceding siblings ...)
  2014-03-01 22:52 ` emsr at gcc dot gnu.org
@ 2014-03-01 22:57 ` emsr at gcc dot gnu.org
  2014-03-19 13:23 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: emsr at gcc dot gnu.org @ 2014-03-01 22:57 UTC (permalink / raw)
  To: gcc-bugs

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

emsr at gcc dot gnu.org changed:

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

--- Comment #21 from emsr at gcc dot gnu.org ---
Fixed.


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (21 preceding siblings ...)
  2014-03-01 22:57 ` emsr at gcc dot gnu.org
@ 2014-03-19 13:23 ` redi at gcc dot gnu.org
  2014-03-25 10:58 ` d.v.a at ngs dot ru
  2015-03-19 10:58 ` paolo.carlini at oracle dot com
  24 siblings, 0 replies; 26+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-19 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #22 from Jonathan Wakely <redi at gcc dot gnu.org> ---
For the record, I think r207164 fixed this


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (22 preceding siblings ...)
  2014-03-19 13:23 ` redi at gcc dot gnu.org
@ 2014-03-25 10:58 ` d.v.a at ngs dot ru
  2015-03-19 10:58 ` paolo.carlini at oracle dot com
  24 siblings, 0 replies; 26+ messages in thread
From: d.v.a at ngs dot ru @ 2014-03-25 10:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |d.v.a at ngs dot ru

--- Comment #23 from __vic <d.v.a at ngs dot ru> ---
Is it related bug?

struct C
{
    const std::string &st_ref;

    explicit C(const std::string &st) : st_ref{st}
    {
        std::cout << &st << ' ' << &st_ref << std::endl;
        assert(&st == &st_ref);
    }
};

assert() fires! gcc 4.8.2
If we replace st_ref{st} with st_ref(st), assert() doesn't fire.


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

* [Bug c++/50025] [DR 1288] C++0x initialization syntax doesn't work for class members of reference type
  2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
                   ` (23 preceding siblings ...)
  2014-03-25 10:58 ` d.v.a at ngs dot ru
@ 2015-03-19 10:58 ` paolo.carlini at oracle dot com
  24 siblings, 0 replies; 26+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-19 10:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andreaskem at web dot de

--- Comment #25 from Paolo Carlini <paolo.carlini at oracle dot com> ---
*** Bug 60583 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2015-03-19 10:38 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
2011-08-08 22:29 ` [Bug c++/50025] " redi at gcc dot gnu.org
2011-08-08 22:47 ` redi at gcc dot gnu.org
2011-08-08 23:31 ` akrzemi1 at gmail dot com
2011-08-16 16:44 ` redi at gcc dot gnu.org
2011-10-26 10:34 ` paolo.carlini at oracle dot com
2011-10-26 10:45 ` daniel.kruegler at googlemail dot com
2011-10-26 10:59 ` [Bug c++/50025] [DR 1288] " redi at gcc dot gnu.org
2012-04-14  7:07 ` marc.glisse at normalesup dot org
2012-04-14 11:02 ` redi at gcc dot gnu.org
2012-09-13 12:45 ` temp78593 at mutluit dot com
2012-09-30 10:58 ` redi at gcc dot gnu.org
2013-01-18 15:35 ` redi at gcc dot gnu.org
2013-01-19 20:42 ` redi at gcc dot gnu.org
2013-11-03 12:22 ` paolo.carlini at oracle dot com
2014-03-01 11:22 ` ville.voutilainen at gmail dot com
2014-03-01 16:52 ` 3dw4rd at verizon dot net
2014-03-01 16:54 ` 3dw4rd at verizon dot net
2014-03-01 17:01 ` glisse at gcc dot gnu.org
2014-03-01 21:00 ` emsr at gcc dot gnu.org
2014-03-01 21:11 ` jason at gcc dot gnu.org
2014-03-01 22:52 ` emsr at gcc dot gnu.org
2014-03-01 22:57 ` emsr at gcc dot gnu.org
2014-03-19 13:23 ` redi at gcc dot gnu.org
2014-03-25 10:58 ` d.v.a at ngs dot ru
2015-03-19 10:58 ` paolo.carlini at oracle dot com

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