public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58511] New: [c++0x] ICE using static const member variable in constexpr
@ 2013-09-23 19:53 reichelt at gcc dot gnu.org
  2013-09-24 16:52 ` [Bug c++/58511] [4.9 Regression] " mpolacek at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-09-23 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58511
           Summary: [c++0x] ICE using static const member variable in
                    constexpr
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet (compiled with "-std=c++0x") triggers an ICE
since GCC 4.8.0 (when inheriting constructors were introduced):

====================================
struct A
{
  constexpr A(int, int = i) {}
  static const int i;
};

struct B : A
{
  using A::A;
};

constexpr B b(0);
====================================

bug.cc:12:16: error: 'constexpr B::B(int)' called in a constant expression
 constexpr B b(0);
                ^
bug.cc:9:12: note: 'constexpr B::B(int)' is not usable as a constexpr function
because:
   using A::A;
            ^
bug.cc:9:12: internal compiler error: in synthesized_method_walk, at
cp/method.c:1218
0x675548 synthesized_method_walk
        ../../gcc-4.8.0/gcc/cp/method.c:1217
0x679692 explain_implicit_non_constexpr(tree_node*)
        ../../gcc-4.8.0/gcc/cp/method.c:1481
0x69f68b explain_invalid_constexpr_fn(tree_node*)
        ../../gcc-4.8.0/gcc/cp/semantics.c:6379
0x69faf6 cxx_eval_call_expression
        ../../gcc-4.8.0/gcc/cp/semantics.c:6751
0x6a1142 cxx_eval_constant_expression
        ../../gcc-4.8.0/gcc/cp/semantics.c:7814
0x6a14a9 cxx_eval_constant_expression
        ../../gcc-4.8.0/gcc/cp/semantics.c:7835
0x6a4426 cxx_eval_outermost_constant_expr
        ../../gcc-4.8.0/gcc/cp/semantics.c:8115
0x5bd69d store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc-4.8.0/gcc/cp/typeck2.c:722
0x540b40 check_initializer
        ../../gcc-4.8.0/gcc/cp/decl.c:5711
0x5537b5 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc-4.8.0/gcc/cp/decl.c:6328
0x62afeb cp_parser_init_declarator
        ../../gcc-4.8.0/gcc/cp/parser.c:16038
0x62b85e cp_parser_simple_declaration
        ../../gcc-4.8.0/gcc/cp/parser.c:10567
0x62d630 cp_parser_block_declaration
        ../../gcc-4.8.0/gcc/cp/parser.c:10448
0x6361fb cp_parser_declaration
        ../../gcc-4.8.0/gcc/cp/parser.c:10345
0x634ecd cp_parser_declaration_seq_opt
        ../../gcc-4.8.0/gcc/cp/parser.c:10231
0x636772 cp_parser_translation_unit
        ../../gcc-4.8.0/gcc/cp/parser.c:3807
0x636772 c_parse_file()
        ../../gcc-4.8.0/gcc/cp/parser.c:28186
0x73e504 c_common_parse_file()
        ../../gcc-4.8.0/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]


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

* [Bug c++/58511] [4.9 Regression] [c++0x] ICE using static const member variable in constexpr
  2013-09-23 19:53 [Bug c++/58511] New: [c++0x] ICE using static const member variable in constexpr reichelt at gcc dot gnu.org
@ 2013-09-24 16:52 ` mpolacek at gcc dot gnu.org
  2013-11-05 14:30 ` [Bug c++/58511] [4.8/4.9 Regression] [c++11] " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-24 16:52 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-09-24
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.9.0
            Summary|[c++0x] ICE using static    |[4.9 Regression] [c++0x]
                   |const member variable in    |ICE using static const
                   |constexpr                   |member variable in
                   |                            |constexpr
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed with trunk, I don't see the ICE with 4.8.2.


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

* [Bug c++/58511] [4.8/4.9 Regression] [c++11] ICE using static const member variable in constexpr
  2013-09-23 19:53 [Bug c++/58511] New: [c++0x] ICE using static const member variable in constexpr reichelt at gcc dot gnu.org
  2013-09-24 16:52 ` [Bug c++/58511] [4.9 Regression] " mpolacek at gcc dot gnu.org
@ 2013-11-05 14:30 ` rguenth at gcc dot gnu.org
  2014-03-04 11:04 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-05 14:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P5


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

* [Bug c++/58511] [4.8/4.9 Regression] [c++11] ICE using static const member variable in constexpr
  2013-09-23 19:53 [Bug c++/58511] New: [c++0x] ICE using static const member variable in constexpr reichelt at gcc dot gnu.org
  2013-09-24 16:52 ` [Bug c++/58511] [4.9 Regression] " mpolacek at gcc dot gnu.org
  2013-11-05 14:30 ` [Bug c++/58511] [4.8/4.9 Regression] [c++11] " rguenth at gcc dot gnu.org
@ 2014-03-04 11:04 ` paolo.carlini at oracle dot com
  2014-03-04 11:05 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-03-04 11:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Maybe just a STRIP_TEMPLATE issue. Looking into it.


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

* [Bug c++/58511] [4.8/4.9 Regression] [c++11] ICE using static const member variable in constexpr
  2013-09-23 19:53 [Bug c++/58511] New: [c++0x] ICE using static const member variable in constexpr reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-03-04 11:04 ` paolo.carlini at oracle dot com
@ 2014-03-04 11:05 ` paolo.carlini at oracle dot com
  2014-04-22 11:36 ` [Bug c++/58511] [4.8/4.9/4.10 " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-03-04 11:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Sorry, I wanted to add to PR60389.


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

* [Bug c++/58511] [4.8/4.9/4.10 Regression] [c++11] ICE using static const member variable in constexpr
  2013-09-23 19:53 [Bug c++/58511] New: [c++0x] ICE using static const member variable in constexpr reichelt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-03-04 11:05 ` paolo.carlini at oracle dot com
@ 2014-04-22 11:36 ` jakub at gcc dot gnu.org
  2014-07-14  5:26 ` jason at gcc dot gnu.org
  2014-07-14  5:26 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-04-22 11:36 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.9.0                       |4.9.1

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.9.0 has been released


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

* [Bug c++/58511] [4.8/4.9/4.10 Regression] [c++11] ICE using static const member variable in constexpr
  2013-09-23 19:53 [Bug c++/58511] New: [c++0x] ICE using static const member variable in constexpr reichelt at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-04-22 11:36 ` [Bug c++/58511] [4.8/4.9/4.10 " jakub at gcc dot gnu.org
@ 2014-07-14  5:26 ` jason at gcc dot gnu.org
  2014-07-14  5:26 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2014-07-14  5:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Mon Jul 14 05:25:37 2014
New Revision: 212507

URL: https://gcc.gnu.org/viewcvs?rev=212507&root=gcc&view=rev
Log:
    PR c++/58511
    * semantics.c (is_instantiation_of_constexpr): Return true for
    defaulted functions, too.
    (explain_invalid_constexpr_fn): Only use
    explain_implicit_non_constexpr if !DECL_DECLARED_CONSTEXPR_P.
    * method.c (explain_implicit_non_constexpr): Pass
    DECL_INHERITED_CTOR_BASE to explain_implicit_non_constexpr.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-inhctor1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/method.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi3.C


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

* [Bug c++/58511] [4.8/4.9/4.10 Regression] [c++11] ICE using static const member variable in constexpr
  2013-09-23 19:53 [Bug c++/58511] New: [c++0x] ICE using static const member variable in constexpr reichelt at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-07-14  5:26 ` jason at gcc dot gnu.org
@ 2014-07-14  5:26 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2014-07-14  5:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
   Target Milestone|4.9.1                       |4.10.0

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed on trunk.


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

end of thread, other threads:[~2014-07-14  5:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-23 19:53 [Bug c++/58511] New: [c++0x] ICE using static const member variable in constexpr reichelt at gcc dot gnu.org
2013-09-24 16:52 ` [Bug c++/58511] [4.9 Regression] " mpolacek at gcc dot gnu.org
2013-11-05 14:30 ` [Bug c++/58511] [4.8/4.9 Regression] [c++11] " rguenth at gcc dot gnu.org
2014-03-04 11:04 ` paolo.carlini at oracle dot com
2014-03-04 11:05 ` paolo.carlini at oracle dot com
2014-04-22 11:36 ` [Bug c++/58511] [4.8/4.9/4.10 " jakub at gcc dot gnu.org
2014-07-14  5:26 ` jason at gcc dot gnu.org
2014-07-14  5:26 ` jason 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).