diff options
author | Marek Polacek <polacek@redhat.com> | 2018-12-13 20:47:32 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2018-12-13 20:47:32 +0000 |
commit | b46e1a69975d64ad436ff1c928e008105b2b2a8d (patch) | |
tree | 0f98a2372671ce74db10afc5a1628accc70aa17e /gcc/cp/mangle.c | |
parent | 2b462958e2db15dc6f55ed361d47cdbc62d64ea0 (diff) | |
download | gcc-b46e1a69975d64ad436ff1c928e008105b2b2a8d.zip gcc-b46e1a69975d64ad436ff1c928e008105b2b2a8d.tar.gz gcc-b46e1a69975d64ad436ff1c928e008105b2b2a8d.tar.bz2 |
PR c++/88216 - ICE with class type in non-type template parameter.
* mangle.c (write_expression): Handle TARGET_EXPR and
VIEW_CONVERT_EXPR.
* pt.c (convert_nontype_argument): Don't call
get_template_parm_object for value-dependent expressions.
* g++.dg/cpp2a/nontype-class9.C: New test.
From-SVN: r267108
Diffstat (limited to 'gcc/cp/mangle.c')
-rw-r--r-- | gcc/cp/mangle.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 64415894..5624788 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -2836,13 +2836,21 @@ write_expression (tree expr) { enum tree_code code = TREE_CODE (expr); + if (TREE_CODE (expr) == TARGET_EXPR) + { + expr = TARGET_EXPR_INITIAL (expr); + code = TREE_CODE (expr); + } + /* Skip NOP_EXPR and CONVERT_EXPR. They can occur when (say) a pointer argument is converted (via qualification conversions) to another type. */ while (CONVERT_EXPR_CODE_P (code) || location_wrapper_p (expr) /* Parentheses aren't mangled. */ || code == PAREN_EXPR - || code == NON_LVALUE_EXPR) + || code == NON_LVALUE_EXPR + || (code == VIEW_CONVERT_EXPR + && TREE_CODE (TREE_OPERAND (expr, 0)) == TEMPLATE_PARM_INDEX)) { expr = TREE_OPERAND (expr, 0); code = TREE_CODE (expr); |