Commit b34fd35b by Marek Polacek Committed by Marek Polacek

PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.

	* pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__
	inside a template function value-dependent.

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

From-SVN: r274009
parent 0c60e39e
2019-08-02 Marek Polacek <polacek@redhat.com>
PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.
* pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__
inside a template function value-dependent.
2019-08-02 Paolo Carlini <paolo.carlini@oracle.com> 2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
* tree.c (handle_nodiscard_attribute): Do not warn about nodiscard * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
......
...@@ -25553,7 +25553,14 @@ value_dependent_expression_p (tree expression) ...@@ -25553,7 +25553,14 @@ value_dependent_expression_p (tree expression)
if (DECL_HAS_VALUE_EXPR_P (expression)) if (DECL_HAS_VALUE_EXPR_P (expression))
{ {
tree value_expr = DECL_VALUE_EXPR (expression); tree value_expr = DECL_VALUE_EXPR (expression);
if (value_dependent_expression_p (value_expr)) if (value_dependent_expression_p (value_expr)
/* __PRETTY_FUNCTION__ inside a template function is dependent
on the name of the function. */
|| (DECL_PRETTY_FUNCTION_P (expression)
/* It might be used in a template, but not a template
function, in which case its DECL_VALUE_EXPR will be
"top level". */
&& value_expr == error_mark_node))
return true; return true;
} }
return false; return false;
......
2019-08-02 Marek Polacek <polacek@redhat.com>
PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.
* g++.dg/cpp1y/lambda-generic-pretty1.C: New test.
2019-08-02 Uroš Bizjak <ubizjak@gmail.com> 2019-08-02 Uroš Bizjak <ubizjak@gmail.com>
PR target/91323 PR target/91323
......
// PR c++/91230
// { dg-do compile { target c++14 } }
struct StringWrapper {
const char* Value;
};
template <typename T>
void f() {
[](auto) {
StringWrapper{__PRETTY_FUNCTION__};
};
}
int main() {
f<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