re PR c++/84125 (ICE in generic lambda when static_assert argument is implicitly converted to bool)

PR c++/84125
	* typeck.c (build_address): Relax the assert when
	processing_template_decl.

	* g++.dg/cpp1y/lambda-generic-84125.C:New test.

From-SVN: r257311
This commit is contained in:
Marek Polacek 2018-02-01 20:32:33 +00:00 committed by Marek Polacek
parent ae976c332d
commit d15f0fa7f9
4 changed files with 23 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2018-02-01 Marek Polacek <polacek@redhat.com>
PR c++/84125
* typeck.c (build_address): Relax the assert when
processing_template_decl.
2018-02-01 Jason Merrill <jason@redhat.com>
PR c++/84126 - ICE with variadic generic lambda

View file

@ -5735,7 +5735,8 @@ build_address (tree t)
{
if (error_operand_p (t) || !cxx_mark_addressable (t))
return error_mark_node;
gcc_checking_assert (TREE_CODE (t) != CONSTRUCTOR);
gcc_checking_assert (TREE_CODE (t) != CONSTRUCTOR
|| processing_template_decl);
t = build_fold_addr_expr_loc (EXPR_LOCATION (t), t);
if (TREE_CODE (t) != ADDR_EXPR)
t = rvalue (t);

View file

@ -1,3 +1,8 @@
2018-02-01 Marek Polacek <polacek@redhat.com>
PR c++/84125
* g++.dg/cpp1y/lambda-generic-84125.C:New test.
2018-01-30 Jeff Law <law@redhat.com>
PR target/84128

View file

@ -0,0 +1,10 @@
// PR c++/84125
// { dg-do compile { target c++14 } }
struct X { constexpr operator bool() const { return true; } };
int main(){
[](auto) {
static_assert(X{}, "");
};
}