re PR c++/2922 ([DR 197] two-stage lookup for unqualified function calls with type...
authorDouglas Gregor <doug.gregor@gmail.com>
Thu, 21 Jul 2005 03:56:46 +0000 (03:56 +0000)
committerDoug Gregor <dgregor@gcc.gnu.org>
Thu, 21 Jul 2005 03:56:46 +0000 (03:56 +0000)
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

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/two-stage2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/lookup/two-stage3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/lookup/two-stage4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/call3.C
gcc/testsuite/g++.dg/template/crash37.C
gcc/testsuite/g++.dg/template/ptrmem4.C
gcc/testsuite/g++.old-deja/g++.other/pmf3.C

index acbc2d6bc0a07b5defbc125d720449877bb288f8..f701137d2fdbf6efd20054a0d472fb8556fcee0b 100644 (file)
@@ -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 (file)
index 0000000..e758fc8
--- /dev/null
@@ -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 (file)
index 0000000..fff853c
--- /dev/null
@@ -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 (file)
index 0000000..bbb44af
--- /dev/null
@@ -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);
+}
index 1dd2b51b3ebf634d3ba87525fcb083d9a182f3d1..bbb6c7b3a2bdc4e7d04dae1759f6006943415c5f 100644 (file)
@@ -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;
index b2f0cdb7b66e93ae105ca5a2941f0a73a005d705..0d837bd132d35e193d7367353792815405532dbe 100644 (file)
@@ -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 "" }
  }
 };
 
index 5cfd8c7c8d604d9f22d1f45b5d2bcac50ca7e5c6..db80eecf830f8ecbc54b8e7739adb02c7c54ab26 100644 (file)
@@ -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 "" }
 }
index 695a1c584aba6e87c31a1fbeac24ce755e491f6b..e5f757d07af4060eb022a57df32c5bb924994550 100644 (file)
@@ -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();