diff options
author | Douglas Gregor <doug.gregor@gmail.com> | 2005-07-21 03:56:46 +0000 |
---|---|---|
committer | Doug Gregor <dgregor@gcc.gnu.org> | 2005-07-21 03:56:46 +0000 |
commit | 3a9d5f263933156f289c3bc1f3490f14a1151184 (patch) | |
tree | 1babb06d952f69f9985e26582cc5d4f204969601 /gcc | |
parent | 20ac1e0392c91bf7c5ba645b58622a7641675a8d (diff) | |
download | gcc-3a9d5f263933156f289c3bc1f3490f14a1151184.zip gcc-3a9d5f263933156f289c3bc1f3490f14a1151184.tar.gz gcc-3a9d5f263933156f289c3bc1f3490f14a1151184.tar.bz2 |
re PR c++/2922 ([DR 197] two-stage lookup for unqualified function calls with type-dependent arguments)
2005-07-20 Douglas Gregor <doug.gregor@gmail.com>
PR c++/2922
* g++.dg/lookup/two-stage2.C: New.
* g++.dg/lookup/two-stage3.C: New.
* g++.dg/lookup/two-stage4.C: New. Illustrates how we have not yet
fixed two-stage name lookup for operators.
* g++.dg/template/call3.C: Compiler now produces an appropriate
error message.
* g++.dg/template/crash37.C: Compiler now describes bla() on line
14 as a candidate.
* g++.dg/template/ptrmem4.C: Compiler produces different error
message.
* g++.old-deja/g++.other/pmf3.C: Compiler now describes
connect_to_method as a candidate.
From-SVN: r102217
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/two-stage2.C | 19 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/two-stage3.C | 22 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/two-stage4.C | 20 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/call3.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/crash37.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/ptrmem4.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/pmf3.C | 4 |
8 files changed, 84 insertions, 7 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index acbc2d6..f701137 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,19 @@ +2005-07-20 Douglas Gregor <doug.gregor@gmail.com> + + PR c++/2922 + * g++.dg/lookup/two-stage2.C: New. + * g++.dg/lookup/two-stage3.C: New. + * g++.dg/lookup/two-stage4.C: New. Illustrates how we have not yet + fixed two-stage name lookup for operators. + * g++.dg/template/call3.C: Compiler now produces an appropriate + error message. + * g++.dg/template/crash37.C: Compiler now describes bla() on line + 14 as a candidate. + * g++.dg/template/ptrmem4.C: Compiler produces different error + message. + * g++.old-deja/g++.other/pmf3.C: Compiler now describes + connect_to_method as a candidate. + 2005-07-20 James A. Morrison <phython@gcc.gnu.org> * gcc.dg/fold-alloc-1.c: New test. diff --git a/gcc/testsuite/g++.dg/lookup/two-stage2.C b/gcc/testsuite/g++.dg/lookup/two-stage2.C new file mode 100644 index 0000000..e758fc8 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/two-stage2.C @@ -0,0 +1,19 @@ +// { dg-do compile } +// PR c++/2922 + +char& f(char); + +template<class T> +void g(T t) +{ + char& c1 = f(1); // not dependent + char& c2 = f(t); // dependent +} + +int&f (int); + +int main() +{ + g(2); // f(char) followed by f(int) + g('a'); // two f(char) +} diff --git a/gcc/testsuite/g++.dg/lookup/two-stage3.C b/gcc/testsuite/g++.dg/lookup/two-stage3.C new file mode 100644 index 0000000..fff853c --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/two-stage3.C @@ -0,0 +1,22 @@ +// { dg-do compile } +// PR c++/2922 + +namespace tpl_ { + +template<class T> +char test(T); + +template<class T> +struct check +{ + static T const t; + enum { value = 1 == sizeof(test(t)) }; +}; + +double test(int); + +} + +bool const two_phase_lookup_supported = tpl_::check<int>::value; + +int compile_time_assert[two_phase_lookup_supported ? 1 : -1]; diff --git a/gcc/testsuite/g++.dg/lookup/two-stage4.C b/gcc/testsuite/g++.dg/lookup/two-stage4.C new file mode 100644 index 0000000..bbb44af --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/two-stage4.C @@ -0,0 +1,20 @@ + +// Contributed by Douglas Gregor <doug.gregor@gmail.com> + +template<class T> struct wrap {}; + +template<typename T> bool& operator==(wrap<T>, wrap<T>); + +template<typename T> +void g(T, wrap<wrap<int> > x) +{ + bool& b = x == x; // { dg-bogus "invalid initialization of reference" "" { xfail *-*-*} } +} + +template<typename T> int& operator==(wrap<wrap<T> >, wrap<wrap<T> >); + +void h() +{ + wrap<wrap<int> > x; + g(17, x); +} diff --git a/gcc/testsuite/g++.dg/template/call3.C b/gcc/testsuite/g++.dg/template/call3.C index 1dd2b51..bbb6c7b 100644 --- a/gcc/testsuite/g++.dg/template/call3.C +++ b/gcc/testsuite/g++.dg/template/call3.C @@ -9,7 +9,7 @@ struct A template <typename T> struct B : T { - B() { foo(T()); } + B() { foo(T()); } // { dg-error "cannot convert" } }; B<A> b; diff --git a/gcc/testsuite/g++.dg/template/crash37.C b/gcc/testsuite/g++.dg/template/crash37.C index b2f0cdb..0d837bd 100644 --- a/gcc/testsuite/g++.dg/template/crash37.C +++ b/gcc/testsuite/g++.dg/template/crash37.C @@ -11,7 +11,7 @@ struct coperator_stack struct helper {}; template<class F> -void bla(F f) +void bla(F f) // { dg-error "candidates" } { } @@ -20,7 +20,7 @@ struct definition { definition() { - bla(coperator_stack::push3<helper>); // { dg-error "" } + bla(coperator_stack::push3<helper>); // { dg-error "" } } }; diff --git a/gcc/testsuite/g++.dg/template/ptrmem4.C b/gcc/testsuite/g++.dg/template/ptrmem4.C index 5cfd8c7..db80eec 100644 --- a/gcc/testsuite/g++.dg/template/ptrmem4.C +++ b/gcc/testsuite/g++.dg/template/ptrmem4.C @@ -6,7 +6,7 @@ // Pointer to member function template argument deduction ICE. -template <class CONT> void queryAliases(CONT& fill_me); // { dg-error "argument" } +template <class CONT> void queryAliases(CONT& fill_me); // { dg-error "candidates" } struct SpyExample { @@ -16,5 +16,5 @@ struct SpyExample void SpyExample::ready() { - queryAliases(inputs); // { dg-error "" } + queryAliases(inputs); // { dg-error "" } } diff --git a/gcc/testsuite/g++.old-deja/g++.other/pmf3.C b/gcc/testsuite/g++.old-deja/g++.other/pmf3.C index 695a1c5..e5f757d 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/pmf3.C +++ b/gcc/testsuite/g++.old-deja/g++.other/pmf3.C @@ -5,11 +5,11 @@ template<class T> void connect_to_method( T *receiver, - void (T::*method)()) + void (T::*method)()) // { dg-error "candidates are" } {} class Gtk_Base -{ +{ public: void expose(); void show(); |