Commit 32913637 by Nathan Sidwell

re PR c++/78550 (bit field and std::initializer_list)

	PR c++/78550
	* convert.c (convert_to_integer_1): Maybe fold conversions to
	integral types with fewer bits than its mode.

	testsuite/
	PR c++/78550
	* g++.dg/cpp1y/pr78550.C: New.

From-SVN: r243479
parent 345bd7eb
2016-12-09 Nathan Sidwell <nathan@acm.org>
PR C++/78550
* convert.c (convert_to_integer_1): Maybe fold conversions to
integral types with fewer bits than its mode.
2016-12-09 Martin Liska <mliska@suse.cz>
* tree-pretty-print.c (pretty_print_string): Escape non-printable
......@@ -67,9 +73,8 @@
2016-12-08 Dmitry Vyukov <dvyukov@google.com>
* opts.c (finish_options): Enable
-fsanitize-address-use-after-scope only if -fsanitize=address is enabled
(not -fsanitize=kernel-address).
* opts.c (finish_options): Enable -fsanitize-address-use-after-scope
only if -fsanitize=address is enabled (not -fsanitize=kernel-address).
* doc/invoke.texi (-fsanitize=kernel-address):
Don't say that it enables -fsanitize-address-use-after-scope.
......@@ -646,10 +646,11 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
to TYPE. */
else if (TREE_CODE (type) == ENUMERAL_TYPE
|| outprec != GET_MODE_PRECISION (TYPE_MODE (type)))
return build1 (NOP_EXPR, type,
convert (lang_hooks.types.type_for_mode
(TYPE_MODE (type), TYPE_UNSIGNED (type)),
expr));
{
expr = convert (lang_hooks.types.type_for_mode
(TYPE_MODE (type), TYPE_UNSIGNED (type)), expr);
return maybe_fold_build1_loc (dofold, loc, NOP_EXPR, type, expr);
}
/* Here detect when we can distribute the truncation down past some
arithmetic. For example, if adding two longs and converting to an
......
2016-12-09 Nathan Sidwell <nathan@acm.org>
PR c++/78550
* g++.dg/cpp1y/pr78550.C: New.
2016-12-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/44265
......
// { dg-do compile { target c++14 } }
// PR 78550 ICE with initializer_list and bitfield member
namespace std
{
template <class T>
struct initializer_list
{
const T *a;
__SIZE_TYPE__ b;
constexpr initializer_list (const T *x, __SIZE_TYPE__ y) : a(x), b(y) { }
};
}
template <typename T>
struct A {
A (std::initializer_list<T>);
};
struct B {
int k : 1;
};
A<B> a{{0}};
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