emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/merge-cedet-tests cfdd9a5 070/316: Tests for polym


From: Edward John Steere
Subject: [Emacs-diffs] scratch/merge-cedet-tests cfdd9a5 070/316: Tests for polymorphism
Date: Sat, 28 Jan 2017 09:09:49 +0000 (UTC)

branch: scratch/merge-cedet-tests
commit cfdd9a5446a71facdab4a04ea856d325b11e407a
Author: Eric Ludlam <address@hidden>
Commit: Edward John Steere <address@hidden>

    Tests for polymorphism
    
    * test/manual/cedet/cedet/semantic/tests/testpoly.cpp
     Tests for polymorphism with a couple examples where we could try to
     disambiguate.
---
 .../manual/cedet/cedet/semantic/tests/testpoly.cpp |   59 ++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/test/manual/cedet/cedet/semantic/tests/testpoly.cpp 
b/test/manual/cedet/cedet/semantic/tests/testpoly.cpp
new file mode 100644
index 0000000..769a5be
--- /dev/null
+++ b/test/manual/cedet/cedet/semantic/tests/testpoly.cpp
@@ -0,0 +1,59 @@
+// Test disambiguation of polymorphic methods.
+
+class xx {
+public:
+  int int_field;
+  int char_field;
+  char foo(char x);
+  int foo (int x);
+};
+
+int whatever() {
+  xx x;
+
+  char same_char;
+  int same_int;
+  int i;
+  char c;
+
+  i = x.foo(same // -1-
+           // #1# ( "same_int" )
+           );
+
+  c = x.foo(same // -2-
+           // #2# ( "same_char" )
+           );
+
+}
+
+// Example from Dmitry
+struct foo {
+  int a;
+  int b;
+};
+
+struct bar {
+  int c;
+  int d;
+};
+
+foo tee(int i) {
+  foo f;
+  return f;
+}
+
+bar tee(long i) {
+  bar b;
+  return b;
+}
+
+int main() {
+  int i = 1;
+  long l = 2;
+
+  tee(i).//-3-
+    ; // #3# ( "a" "b" )
+
+  tee(l).//-4-
+    ; // #4# ( "c" "d" )
+}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]