diff options
author | Jason Merrill <jason@redhat.com> | 2013-03-16 22:36:26 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2013-03-16 22:36:26 -0400 |
commit | 346928a2c9741ac4347b5b29551259a93bc30a7f (patch) | |
tree | df6b567bd64a3f40acea6f902b5d401a6d9e733c /gcc | |
parent | 0cc5ae8d62ce64803914496b45b817f27813cff2 (diff) | |
download | gcc-346928a2c9741ac4347b5b29551259a93bc30a7f.zip gcc-346928a2c9741ac4347b5b29551259a93bc30a7f.tar.gz gcc-346928a2c9741ac4347b5b29551259a93bc30a7f.tar.bz2 |
DR 657
DR 657
* pt.c (tsubst_function_type): Call abstract_virtuals_error_sfinae.
(tsubst_arg_types): Likewise.
From-SVN: r196733
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/sfinae-dr657.C | 22 |
3 files changed, 34 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 70a71be..2f5f873 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2013-03-16 Jason Merrill <jason@redhat.com> + DR 657 + * pt.c (tsubst_function_type): Call abstract_virtuals_error_sfinae. + (tsubst_arg_types): Likewise. + DR 1518 PR c++/54835 * call.c (convert_like_real): Check for explicit constructors diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c07ed32..cad1c60 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -10850,6 +10850,9 @@ tsubst_arg_types (tree arg_types, } return error_mark_node; } + /* DR 657. */ + if (abstract_virtuals_error_sfinae (NULL_TREE, type, complain)) + return error_mark_node; /* Do array-to-pointer, function-to-pointer conversion, and ignore top-level qualifiers as required. */ @@ -10912,10 +10915,8 @@ tsubst_function_type (tree t, return_type = tsubst (TREE_TYPE (t), args, complain, in_decl); if (return_type == error_mark_node) return error_mark_node; - /* The standard does not presently indicate that creation of a - function type with an invalid return type is a deduction failure. - However, that is clearly analogous to creating an array of "void" - or a reference to a reference. This is core issue #486. */ + /* DR 486 clarifies that creation of a function type with an + invalid return type is a deduction failure. */ if (TREE_CODE (return_type) == ARRAY_TYPE || TREE_CODE (return_type) == FUNCTION_TYPE) { @@ -10928,6 +10929,9 @@ tsubst_function_type (tree t, } return error_mark_node; } + /* And DR 657. */ + if (abstract_virtuals_error_sfinae (NULL_TREE, return_type, complain)) + return error_mark_node; /* Substitute the argument types. */ arg_types = tsubst_arg_types (TYPE_ARG_TYPES (t), args, NULL_TREE, diff --git a/gcc/testsuite/g++.dg/template/sfinae-dr657.C b/gcc/testsuite/g++.dg/template/sfinae-dr657.C new file mode 100644 index 0000000..b78b5a9 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sfinae-dr657.C @@ -0,0 +1,22 @@ +// DR 657 +// Test that a return or parameter type with abstract class type causes a +// deduction failure. + +struct A +{ + A(); + A(int); + virtual void f() = 0; +}; + +template<class T> T declval(); +template<class T> int declval(...); + +template<class T> void arg(T); +template<class T> int arg(...); + +int main() +{ + int i = declval<A>(); + i = arg<A>(1); +} |