aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-11-13 16:49:16 -0500
committerJason Merrill <jason@gcc.gnu.org>2017-11-13 16:49:16 -0500
commitc360a6681734fcde601f260b02e69bda13d14085 (patch)
tree0994684b16f8526820ca22aaafcdfe10a126c8d2 /gcc/cp/call.c
parentfb771b9dad6ef78a985353128cea48e620eb4324 (diff)
downloadgcc-c360a6681734fcde601f260b02e69bda13d14085.zip
gcc-c360a6681734fcde601f260b02e69bda13d14085.tar.gz
gcc-c360a6681734fcde601f260b02e69bda13d14085.tar.bz2
PR c++/82360 - ICE with static_cast in template.
* call.c (perform_direct_initialization_if_possible): Check processing_template_decl. * typeck.c (build_static_cast_1): Likewise. From-SVN: r254710
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 6875492..e6e0f90 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -10647,6 +10647,16 @@ perform_direct_initialization_if_possible (tree type,
LOOKUP_NORMAL, complain);
if (!conv || conv->bad_p)
expr = NULL_TREE;
+ else if (processing_template_decl && conv->kind != ck_identity)
+ {
+ /* In a template, we are only concerned about determining the
+ type of non-dependent expressions, so we do not have to
+ perform the actual conversion. But for initializers, we
+ need to be able to perform it at instantiation
+ (or instantiate_non_dependent_expr) time. */
+ expr = build1 (IMPLICIT_CONV_EXPR, type, expr);
+ IMPLICIT_CONV_EXPR_DIRECT_INIT (expr) = true;
+ }
else
expr = convert_like_real (conv, expr, NULL_TREE, 0,
/*issue_conversion_warnings=*/false,