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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-02-01
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org,
                   |                            |redi at gcc dot gnu.org
   Target Milestone|---                         |9.0
            Summary|GCC emits undefined         |[9 Regression] GCC emits
                   |references when a constexpr |undefined references when a
                   |initializer_list appears in |constexpr initializer_list
                   |a template function         |appears in a template
                   |                            |function
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
On the trunk this is rejected:
pr89144.C: In function ‘void foo()’:
pr89144.C:6:43: error: ‘std::initializer_list<int>{((const
int*)(&<anonymous>)), 0}’ is not a constant expression
    6 |   constexpr std::initializer_list <int>c {};
      |                                           ^
(but bisection points to r247793, so it is unclear why gcc 8.x doesn't reject
it either).  The ._0 undefined references at -O0 appeared already in 4.7.
If constexpr std::initializer_list<int> c{}; doesn't appear in a template, then
older GCC releases compile it fine, with ._0 being actually defined:
        .type   ._0, @object
        .size   ._0, 0
._0:
or for say c{1, 2, 3}
        .type   ._0, @object
        .size   ._0, 12
._0:
        .long   1
        .long   2
        .long   3
        .align 16
        .type   c.2420, @object
        .size   c.2420, 16
c.2420:
        .quad   ._0
        .quad   3

But trunk rejects it no matter if it is in a template or not (the (const int
*)&TARGET_EXPR ...) doesn't pass reduced_constant_expression_p).

Reply via email to