From 8add4868b501067184e8f6d7bead8e982de7752f Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 15 Aug 2014 16:23:47 +0000 Subject: [PATCH] re PR c++/62072 (No SFINAE performed for function type) /cp 2014-08-15 Paolo Carlini PR c++/62072 Revert: 2014-07-09 Paolo Carlini DR 1584 PR c++/57466 * pt.c (check_cv_quals_for_unify): Implement resolution, disregard cv-qualifiers of function types. /testsuite 2014-08-15 Paolo Carlini PR c++/62072 Revert: 2014-07-09 Paolo Carlini DR 1584 PR c++/57466 * g++.dg/template/pr57466.C: New. * g++.dg/cpp0x/pr57466.C: Likewise. * g++.dg/template/unify6.C: Update. * g++.dg/cpp0x/sfinae52.C: New. From-SVN: r214027 --- gcc/cp/ChangeLog | 11 +++++++++++ gcc/cp/pt.c | 5 ----- gcc/testsuite/ChangeLog | 14 ++++++++++++++ gcc/testsuite/g++.dg/cpp0x/pr57466.C | 18 ------------------ gcc/testsuite/g++.dg/cpp0x/sfinae52.C | 21 +++++++++++++++++++++ gcc/testsuite/g++.dg/template/pr57466.C | 8 -------- gcc/testsuite/g++.dg/template/unify6.C | 11 ++++++----- 7 files changed, 52 insertions(+), 36 deletions(-) delete mode 100644 gcc/testsuite/g++.dg/cpp0x/pr57466.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae52.C delete mode 100644 gcc/testsuite/g++.dg/template/pr57466.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index df3811ce5432..6623e96df350 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +2014-08-15 Paolo Carlini + + PR c++/62072 + Revert: + 2014-07-09 Paolo Carlini + + DR 1584 + PR c++/57466 + * pt.c (check_cv_quals_for_unify): Implement resolution, disregard + cv-qualifiers of function types. + 2014-08-15 Manuel Lopez-Ibanez * call.c (build_conditional_expr_1): Use OPT_Wextra in warning. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0f391c251f1e..6a7bcb819c2b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -17284,11 +17284,6 @@ check_cv_quals_for_unify (int strict, tree arg, tree parm) int arg_quals = cp_type_quals (arg); int parm_quals = cp_type_quals (parm); - /* DR 1584: cv-qualification of a deduced function type is - ignored; see 8.3.5 [dcl.fct]. */ - if (TREE_CODE (arg) == FUNCTION_TYPE) - return 1; - if (TREE_CODE (parm) == TEMPLATE_TYPE_PARM && !(strict & UNIFY_ALLOW_OUTER_MORE_CV_QUAL)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f783027678de..3f19ce745a07 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2014-08-15 Paolo Carlini + + PR c++/62072 + Revert: + 2014-07-09 Paolo Carlini + + DR 1584 + PR c++/57466 + * g++.dg/template/pr57466.C: New. + * g++.dg/cpp0x/pr57466.C: Likewise. + * g++.dg/template/unify6.C: Update. + + * g++.dg/cpp0x/sfinae52.C: New. + 2014-08-15 Ilya Tocar PR target/61878 diff --git a/gcc/testsuite/g++.dg/cpp0x/pr57466.C b/gcc/testsuite/g++.dg/cpp0x/pr57466.C deleted file mode 100644 index 792a3cb9afb4..000000000000 --- a/gcc/testsuite/g++.dg/cpp0x/pr57466.C +++ /dev/null @@ -1,18 +0,0 @@ -// PR c++/57466 -// { dg-do compile { target c++11 } } - -template - constexpr bool - is_pointer(const T*) - { return true; } - -template - constexpr bool - is_pointer(const T&) - { return false; } - -using F = void(); - -constexpr F* f = nullptr; - -static_assert( is_pointer(f), "function pointer is a pointer" ); diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae52.C b/gcc/testsuite/g++.dg/cpp0x/sfinae52.C new file mode 100644 index 000000000000..f255ee120c42 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae52.C @@ -0,0 +1,21 @@ +// PR c++/62072 +// { dg-do compile { target c++11 } } + +template struct tuple_size {}; +template struct tuple_size : tuple_size {}; + +template +struct query { + static constexpr bool value = false; +}; +template +struct query::type> { + static constexpr bool value = true; +}; + +// fine +static_assert( !query::value, "" ); +static_assert( !query::value, "" ); + +// error: invalid use of incomplete type 'struct tuple_size' +static_assert( !query::value, "" ); diff --git a/gcc/testsuite/g++.dg/template/pr57466.C b/gcc/testsuite/g++.dg/template/pr57466.C deleted file mode 100644 index 6dd37102ef63..000000000000 --- a/gcc/testsuite/g++.dg/template/pr57466.C +++ /dev/null @@ -1,8 +0,0 @@ -// DR 1584, PR c++/57466 - -template void f2(const T*); -void g2(); - -void m() { - f2(g2); // OK: cv-qualification of deduced function type ignored -} diff --git a/gcc/testsuite/g++.dg/template/unify6.C b/gcc/testsuite/g++.dg/template/unify6.C index 374bb91c216f..551c96ebb9fe 100644 --- a/gcc/testsuite/g++.dg/template/unify6.C +++ b/gcc/testsuite/g++.dg/template/unify6.C @@ -3,20 +3,21 @@ void Baz (); -template void Foo1 (T *); -template void Foo1 (T const *a) {a (1);} // { dg-error "too many arguments" } +template void Foo1 (T *); // #1 +template void Foo1 (T const *a) {a (1);} // #2 template T const *Foo2 (T *); -template void Foo3 (T *, T const * = 0); +template void Foo3 (T *, T const * = 0); // { dg-message "note" } void Bar () { - Foo1 (&Baz); // { dg-message "required from here" } + Foo1 (&Baz); // #1 Foo2 (&Baz); Foo3 (&Baz); - Foo3 (&Baz, &Baz); + Foo3 (&Baz, &Baz); // { dg-error "no matching function" "" } + // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 21 } } -- 2.47.3