diff options
author | Jason Merrill <jason@redhat.com> | 2019-07-19 02:52:47 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-07-19 02:52:47 -0400 |
commit | 59febe0ece37bedab7f42ae51b9f2b7a372d2950 (patch) | |
tree | 450126733d15b4766d37285fd778df24af4ec88b /gcc/cp/call.c | |
parent | a349418ef5247fdc0063d0daee96f6e8b5fb4a28 (diff) | |
download | gcc-59febe0ece37bedab7f42ae51b9f2b7a372d2950.zip gcc-59febe0ece37bedab7f42ae51b9f2b7a372d2950.tar.gz gcc-59febe0ece37bedab7f42ae51b9f2b7a372d2950.tar.bz2 |
PR c++/90098 - partial specialization and class non-type parms.
A non-type template parameter of class type used in an expression has
const-qualified type; the pt.c hunks deal with this difference from the
unqualified type of the parameter declaration. WAhen we use such a
parameter as an argument to another template, we don't want to confuse
things by copying it, we should pass it straight through. And we might as
well skip copying other classes in constant evaluation context in a
template, too; we'll get the copy semantics at instantiation time.
PR c++/90099
PR c++/90101
* call.c (build_converted_constant_expr_internal): Don't copy.
* pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR
around class non-type parameter.
(unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals.
From-SVN: r273591
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index e597d7a..38d229b 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4278,6 +4278,11 @@ build_converted_constant_expr_internal (tree type, tree expr, if (conv) { + /* Don't copy a class in a template. */ + if (CLASS_TYPE_P (type) && conv->kind == ck_rvalue + && processing_template_decl) + conv = next_conversion (conv); + conv->check_narrowing = true; conv->check_narrowing_const_only = true; expr = convert_like (conv, expr, complain); |