[Bug c++/86515] std::initializer_list constructor is not a constant expression

2018-07-19 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86515

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek  ---
Started with:

commit 27fa846684a0e6d4f52eac665fa05c98a7e4c237
Author: jason 
Date:   Tue May 9 13:48:58 2017 +

PR c++/70167 - array prvalue treated as lvalue

* cp-tree.h (CONSTRUCTOR_C99_COMPOUND_LITERAL): New.
(enum fcl_t): New.
* semantics.c (finish_compound_literal): Add fcl_context parameter.
Only make a static variable for C99 syntax.
* parser.c (cp_parser_postfix_expression): Pass it.
* pt.c (tsubst_copy_and_build): Likewise.
* call.c (extend_ref_init_temps): Set
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@247793
138bc75d-0d04-0410-961f-82ee72b054a4

[Bug c++/86515] std::initializer_list constructor is not a constant expression

2018-07-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86515

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||rejects-valid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-07-14
 Ever confirmed|0   |1

[Bug c++/86515] std::initializer_list constructor is not a constant expression

2018-07-13 Thread sliser at mail dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86515

--- Comment #1 from sliser at mail dot ru ---
struct A1
{
static constexpr auto SupportedVersions = {"1.1", "1.2", "1.3", "1.4"}; //
Ok
};

template
struct A2
{
static constexpr auto SupportedVersions = {"1.1", "1.2", "1.3", "1.4"}; //
Fails
};

error: ‘std::initializer_list{((const char*
const*)(&)), 4}’ is not a constant expression
 static constexpr auto SupportedVersions = {"1.1", "1.2", "1.3", "1.4"};