diff options
author | Dodji Seketeli <dodji@redhat.com> | 2010-11-02 12:58:48 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@gcc.gnu.org> | 2010-11-02 13:58:48 +0100 |
commit | 574e2ba2eec1097f3decd0ade984097e425a4d7f (patch) | |
tree | 8d8adab2c9da335fb908dcd0a21b2377a06f9ec9 /gcc/cp | |
parent | c86af7f3e49d0209d8bf3e54a3d064f98e32debd (diff) | |
download | gcc-574e2ba2eec1097f3decd0ade984097e425a4d7f.zip gcc-574e2ba2eec1097f3decd0ade984097e425a4d7f.tar.gz gcc-574e2ba2eec1097f3decd0ade984097e425a4d7f.tar.bz2 |
Fix PR c++/46170, c++/46162
gcc/cp/ChangeLog:
PR c++/46170
PR c++/46162
* pt.c (check_valid_ptrmem_cst_expr): Add a complain parameter to
control diagnostic.
(convert_nontype_argument, convert_nontype_argument): Pass the
complain parameter down to check_valid_ptrmem_cst_expr.
gcc/testsuite/ChangeLog:
PR c++/46170
PR c++/46162
* g++.dg/template/sfinae26.C: New test.
* g++.dg/template/sfinae27.C: Likewise.
From-SVN: r166181
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/pt.c | 16 |
2 files changed, 18 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1ab6854..66b6671 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,13 @@ 2010-11-02 Dodji Seketeli <dodji@redhat.com> + PR c++/46170 + PR c++/46162 + * pt.c (check_valid_ptrmem_cst_expr): Add a complain parameter to + control diagnostic. + (convert_nontype_argument, convert_nontype_argument): Pass the + complain parameter down to check_valid_ptrmem_cst_expr. + +2010-11-02 Dodji Seketeli <dodji@redhat.com> PR c++/45606 * cp-tree.h (TEMPLATE_TYPE_PARM_SIBLING_PARMS): Remove. (struct template_parm_index_s)<num_siblings>: New field. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index e4975c6..21366d9 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5224,14 +5224,18 @@ convert_nontype_argument_function (tree type, tree expr) Emit an error otherwise. */ static bool -check_valid_ptrmem_cst_expr (tree type, tree expr) +check_valid_ptrmem_cst_expr (tree type, tree expr, + tsubst_flags_t complain) { STRIP_NOPS (expr); if (expr && (null_ptr_cst_p (expr) || TREE_CODE (expr) == PTRMEM_CST)) return true; - error ("%qE is not a valid template argument for type %qT", - expr, type); - error ("it must be a pointer-to-member of the form `&X::Y'"); + if (complain & tf_error) + { + error ("%qE is not a valid template argument for type %qT", + expr, type); + error ("it must be a pointer-to-member of the form `&X::Y'"); + } return false; } @@ -5600,7 +5604,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain) /* [temp.arg.nontype] bullet 1 says the pointer to member expression must be a pointer-to-member constant. */ - if (!check_valid_ptrmem_cst_expr (type, expr)) + if (!check_valid_ptrmem_cst_expr (type, expr, complain)) return error_mark_node; /* There is no way to disable standard conversions in @@ -5632,7 +5636,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain) { /* [temp.arg.nontype] bullet 1 says the pointer to member expression must be a pointer-to-member constant. */ - if (!check_valid_ptrmem_cst_expr (type, expr)) + if (!check_valid_ptrmem_cst_expr (type, expr, complain)) return error_mark_node; expr = perform_qualification_conversions (type, expr); |