OSDN Git Service

2005-07-20 Douglas Gregor <doug.gregor@gmail.com>
authordgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Jul 2005 03:56:46 +0000 (03:56 +0000)
committerdgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Jul 2005 03:56:46 +0000 (03:56 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102217 138bc75d-0d04-0410-961f-82ee72b054a4

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 acbc2d6..f701137 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 1dd2b51..bbb6c7b 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 b2f0cdb..0d837bd 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 5cfd8c7..db80eec 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 695a1c5..e5f757d 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();