diff options
author | glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-02 22:26:24 +0000 |
---|---|---|
committer | glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-02 22:26:24 +0000 |
commit | 5a5f1b4888d9cd093b608d0f547d50d2a4928908 (patch) | |
tree | 08be9415820ccf2941fc7d0b1d5aca50ab703999 | |
parent | 0499d147fe331a7bad5a983fcb96c17ba6a0231a (diff) | |
download | ppe42-gcc-5a5f1b4888d9cd093b608d0f547d50d2a4928908.tar.gz ppe42-gcc-5a5f1b4888d9cd093b608d0f547d50d2a4928908.zip |
2014-01-02 Marc Glisse <marc.glisse@inria.fr>
PR c++/59378
gcc/cp/
* typeck.c (build_x_vec_perm_expr): Handle non-dependent arguments
in templates.
gcc/testsuite/
* g++.dg/ext/pr59378.C: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206300 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 23 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/pr59378.C | 8 |
4 files changed, 37 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d27c2a27e62..01a01ab8c43 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-01-02 Marc Glisse <marc.glisse@inria.fr> + + PR c++/59378 + * typeck.c (build_x_vec_perm_expr): Handle non-dependent arguments + in templates. + 2014-01-02 Richard Sandiford <rdsandiford@googlemail.com> Update copyright years diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index f45c5b9944d..84e287e56bc 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4944,12 +4944,25 @@ build_x_vec_perm_expr (location_t loc, tree arg0, tree arg1, tree arg2, tsubst_flags_t complain) { - if (processing_template_decl - && (type_dependent_expression_p (arg0) + tree orig_arg0 = arg0; + tree orig_arg1 = arg1; + tree orig_arg2 = arg2; + if (processing_template_decl) + { + if (type_dependent_expression_p (arg0) || type_dependent_expression_p (arg1) - || type_dependent_expression_p (arg2))) - return build_min_nt_loc (loc, VEC_PERM_EXPR, arg0, arg1, arg2); - return c_build_vec_perm_expr (loc, arg0, arg1, arg2, complain & tf_error); + || type_dependent_expression_p (arg2)) + return build_min_nt_loc (loc, VEC_PERM_EXPR, arg0, arg1, arg2); + arg0 = build_non_dependent_expr (arg0); + if (arg1) + arg1 = build_non_dependent_expr (arg1); + arg2 = build_non_dependent_expr (arg2); + } + tree exp = c_build_vec_perm_expr (loc, arg0, arg1, arg2, complain & tf_error); + if (processing_template_decl && exp != error_mark_node) + return build_min_non_dep (VEC_PERM_EXPR, exp, orig_arg0, + orig_arg1, orig_arg2); + return exp; } /* Return a tree for the sum or difference (RESULTCODE says which) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4a31319270f..fad02af88de 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-01-02 Marc Glisse <marc.glisse@inria.fr> + + PR c++/59378 + * g++.dg/ext/pr59378.C: New file. + 2014-01-02 Richard Sandiford <rdsandiford@googlemail.com> Update copyright years diff --git a/gcc/testsuite/g++.dg/ext/pr59378.C b/gcc/testsuite/g++.dg/ext/pr59378.C new file mode 100644 index 00000000000..19d06b5930a --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pr59378.C @@ -0,0 +1,8 @@ +// { dg-do compile } +typedef int v4si __attribute__ ((vector_size (4*sizeof(int)))); +template<int C> +void traverse(v4si& bounds){ + v4si m = {0,1,2,3}; + bounds = __builtin_shuffle(bounds, m); +} +template void traverse<0>(v4si&); |