Commit 3e7a892c by Jason Merrill Committed by Jason Merrill

PR c++/92446 - deduction of class NTTP.

Another place we need to look through the VIEW_CONVERT_EXPR we add to make a
use of a class NTTP have const type.

	* pt.c (deducible_expression): Look through VIEW_CONVERT_EXPR.

From-SVN: r279228
parent 0a22f996
2019-12-11 Jason Merrill <jason@redhat.com>
PR c++/92446 - deduction of class NTTP.
* pt.c (deducible_expression): Look through VIEW_CONVERT_EXPR.
2019-12-10 Jason Merrill <jason@redhat.com> 2019-12-10 Jason Merrill <jason@redhat.com>
PR c++/92847 - C++20 comparison ambiguity with class template. PR c++/92847 - C++20 comparison ambiguity with class template.
......
...@@ -21183,7 +21183,7 @@ static bool ...@@ -21183,7 +21183,7 @@ static bool
deducible_expression (tree expr) deducible_expression (tree expr)
{ {
/* Strip implicit conversions. */ /* Strip implicit conversions. */
while (CONVERT_EXPR_P (expr)) while (CONVERT_EXPR_P (expr) || TREE_CODE (expr) == VIEW_CONVERT_EXPR)
expr = TREE_OPERAND (expr, 0); expr = TREE_OPERAND (expr, 0);
return (TREE_CODE (expr) == TEMPLATE_PARM_INDEX); return (TREE_CODE (expr) == TEMPLATE_PARM_INDEX);
} }
......
// { dg-do compile { target c++2a } }
struct p { unsigned p_ {}; };
template <p i> struct pp {};
struct qq : public pp <p {}> {};
template <p i> int f (pp <i> const &);
int main ()
{
return f (qq {});
}
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