Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: gdb/testsuite/gdb.cp/member-ptr.exp

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/testsuite/gdb.cp/member-ptr.cc ('k') | gdb/testsuite/gdb.cp/meth-typedefs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/testsuite/gdb.cp/member-ptr.exp
diff --git a/gdb/testsuite/gdb.cp/member-ptr.exp b/gdb/testsuite/gdb.cp/member-ptr.exp
index f569ca9343a0189968aac6d1e716d32932fbedd2..bba03ee8c665fb127d5b311e9b4c22c2ae920260 100644
--- a/gdb/testsuite/gdb.cp/member-ptr.exp
+++ b/gdb/testsuite/gdb.cp/member-ptr.exp
@@ -1,5 +1,4 @@
-# Copyright 1998-1999, 2003-2004, 2006-2012 Free Software Foundation,
-# Inc.
+# Copyright 1998-2013 Free Software Foundation, Inc.
# This file is part of the gdb testsuite
@@ -376,6 +375,33 @@ gdb_test_multiple "print ((int) pmi) == ((char *) &a.j - (char *) & a)" $name {
}
}
+# Check pointers to data members, which are themselves pointers to
+# functions. These behave like data members, not like pointers to
+# member functions.
+
+gdb_test "ptype diamond_pfunc_ptr" \
+ "type = int \\(\\*Diamond::\\*\\)\\(int\\)"
+
+gdb_test "ptype diamond.*diamond_pfunc_ptr" \
+ "type = int \\(\\*\\)\\(int\\)"
+
+# This one is invalid; () binds more tightly than .*, so it tries to
+# call the member pointer as a normal pointer-to-function.
+
+gdb_test "print diamond.*diamond_pfunc_ptr (20)" \
+ "Invalid data type for function to be called."
+
+# With parentheses, it is valid.
+
+gdb_test "print (diamond.*diamond_pfunc_ptr) (20)" \
+ "$vhn = 39"
+
+# Make sure that we do not interpret this as either a member pointer
+# call or a member function call.
+
+gdb_test "print diamond.func_ptr (20)" \
+ "$vhn = 39"
+
# ==========================
# pointer to member function
# ==========================
@@ -595,6 +621,7 @@ gdb_test_multiple "print (a.*pmf)(3)" $name {
}
gdb_test "ptype a.*pmf" "type = int \\(A \\*( const)?, int\\)"
+gdb_test "ptype (a.*pmf)(3)" "type = int"
# Print out a pointer to data member which requires looking into
# a base class.
« no previous file with comments | « gdb/testsuite/gdb.cp/member-ptr.cc ('k') | gdb/testsuite/gdb.cp/meth-typedefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698