public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51707] New: [c++11] constexpr constructor cannot initialize const reference member
@ 2011-12-30  1:24 mg200 at uni dot brighton.ac.uk
  2013-02-22 10:32 ` [Bug c++/51707] " Martin.vGagern at gmx dot net
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mg200 at uni dot brighton.ac.uk @ 2011-12-30  1:24 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51707
           Summary: [c++11] constexpr constructor cannot initialize const
                    reference member
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mg200@uni.brighton.ac.uk


====================

struct S {
    constexpr S() {}
};

struct T {
    constexpr T(S const& s) : s{s} {}
    S const& s;
};

constexpr S s {};
constexpr T t { s };

====================

$ g++ -Wall -std=c++11 constexpr_ref_construct.cpp
constexpr_ref_construct.cpp: In constructor ‘constexpr T::T(const S&)’:
constexpr_ref_construct.cpp:6:34: internal compiler error: in
build_data_member_initialization, at cp/semantics.c:5788

Curiously everything works fine if instead of struct S we typedef S to be an
int (or any other intrinsic type).


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

* [Bug c++/51707] [c++11] constexpr constructor cannot initialize const reference member
  2011-12-30  1:24 [Bug c++/51707] New: [c++11] constexpr constructor cannot initialize const reference member mg200 at uni dot brighton.ac.uk
@ 2013-02-22 10:32 ` Martin.vGagern at gmx dot net
  2014-04-29 16:12 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Martin.vGagern at gmx dot net @ 2013-02-22 10:32 UTC (permalink / raw)
  To: gcc-bugs


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

Martin von Gagern <Martin.vGagern at gmx dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Martin.vGagern at gmx dot
                   |                            |net

--- Comment #1 from Martin von Gagern <Martin.vGagern at gmx dot net> 2013-02-22 10:32:08 UTC ---
I get this same error message in a much more complicated situation. I'll simply
assume that it's the same thing I'm seeing, but will try to remember running my
example through any fix proposed for this issue here.


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

* [Bug c++/51707] [c++11] constexpr constructor cannot initialize const reference member
  2011-12-30  1:24 [Bug c++/51707] New: [c++11] constexpr constructor cannot initialize const reference member mg200 at uni dot brighton.ac.uk
  2013-02-22 10:32 ` [Bug c++/51707] " Martin.vGagern at gmx dot net
@ 2014-04-29 16:12 ` paolo.carlini at oracle dot com
  2014-04-29 16:54 ` paolo.carlini at oracle dot com
  2014-04-29 16:54 ` paolo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-04-29 16:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This is fixed in 4.9.0. I'm adding the testcase and closing the bug.


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

* [Bug c++/51707] [c++11] constexpr constructor cannot initialize const reference member
  2011-12-30  1:24 [Bug c++/51707] New: [c++11] constexpr constructor cannot initialize const reference member mg200 at uni dot brighton.ac.uk
                   ` (2 preceding siblings ...)
  2014-04-29 16:54 ` paolo.carlini at oracle dot com
@ 2014-04-29 16:54 ` paolo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-04-29 16:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Tue Apr 29 16:53:27 2014
New Revision: 209905

URL: http://gcc.gnu.org/viewcvs?rev=209905&root=gcc&view=rev
Log:
2014-04-29  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/51707
    * g++.dg/cpp0x/constexpr-51707.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-51707.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/51707] [c++11] constexpr constructor cannot initialize const reference member
  2011-12-30  1:24 [Bug c++/51707] New: [c++11] constexpr constructor cannot initialize const reference member mg200 at uni dot brighton.ac.uk
  2013-02-22 10:32 ` [Bug c++/51707] " Martin.vGagern at gmx dot net
  2014-04-29 16:12 ` paolo.carlini at oracle dot com
@ 2014-04-29 16:54 ` paolo.carlini at oracle dot com
  2014-04-29 16:54 ` paolo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-04-29 16:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.


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

end of thread, other threads:[~2014-04-29 16:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-30  1:24 [Bug c++/51707] New: [c++11] constexpr constructor cannot initialize const reference member mg200 at uni dot brighton.ac.uk
2013-02-22 10:32 ` [Bug c++/51707] " Martin.vGagern at gmx dot net
2014-04-29 16:12 ` paolo.carlini at oracle dot com
2014-04-29 16:54 ` paolo.carlini at oracle dot com
2014-04-29 16:54 ` paolo 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).