Commit 9f4e09a8 by Marek Polacek Committed by Marek Polacek

PR c++/89119 - ICE with value-initialization in template.

	* pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.

	* g++.dg/cpp0x/initlist-value3.C: New test.

From-SVN: r268400
parent 7341a03a
2019-01-30 Marek Polacek <polacek@redhat.com>
PR c++/89119 - ICE with value-initialization in template.
* pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
2019-01-29 Jason Merrill <jason@redhat.com>
PR c++/86943 - wrong code converting lambda to function pointer.
......
......@@ -19412,6 +19412,11 @@ tsubst_copy_and_build (tree t,
case REQUIRES_EXPR:
RETURN (tsubst_requires_expr (t, args, complain, in_decl));
case RANGE_EXPR:
/* No need to substitute further, a RANGE_EXPR will always be built
with constant operands. */
RETURN (t);
case NON_LVALUE_EXPR:
case VIEW_CONVERT_EXPR:
if (location_wrapper_p (t))
......
2019-01-30 Marek Polacek <polacek@redhat.com>
PR c++/89119 - ICE with value-initialization in template.
* g++.dg/cpp0x/initlist-value3.C: New test.
2019-01-30 Kelvin Nilsen <kelvin@gcc.gnu.org>
* gcc.target/powerpc/vec-extract-schar-1.c: New test.
......
// PR c++/89119
// { dg-do compile { target c++11 } }
struct S { int a[4]; };
template<int N>
struct R { int a[N]; };
template <typename T>
void
fn ()
{
constexpr auto s = S();
constexpr auto s2 = S{};
constexpr auto r = R<4>();
constexpr auto r2 = R<4>{};
}
void
foo ()
{
fn<int>();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment