@@ -214,9 +214,16 @@ inspect_type (struct demangle_parse_info *info,
/* If the symbol is a namespace and its type name is no different
than the name we looked up, this symbol is not a namespace
- alias and does not need to be substituted. */
- if (TYPE_CODE (otype) == TYPE_CODE_NAMESPACE
- && strcmp (TYPE_NAME (type), name) == 0)
+ alias and does not need to be substituted.
+
+ Also, do not attempt to substitute a type that resolves
+ to the same name ("typedef struct foo foo;") since that
+ will cause type_print to try to canonicalize_no_typedefs
+ again. */
+ if ((TYPE_CODE (otype) == TYPE_CODE_NAMESPACE
+ && strcmp (TYPE_NAME (type), name) == 0)
+ || (TYPE_TAG_NAME (type) != NULL
+ && strcmp (TYPE_TAG_NAME (type), name) == 0))
return 0;
is_anon = (TYPE_TAG_NAME (type) == NULL
@@ -17,8 +17,12 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include <stddef.h>
+
int g = 0;
+typedef struct opaque_struct opaque_struct;
+
class C1 {
public:
C1(int i) : i_(i) {}
@@ -37,6 +41,9 @@ public:
}
}
+ void
+ method_with_opaque (opaque_struct *p) {}
+
class Nested {
public:
int
@@ -61,6 +68,7 @@ int main ()
c2.bar ();
c3.foo ();
c3.bar ();
+ c3.method_with_opaque (NULL);
return 0;
}
@@ -56,6 +56,8 @@ gdb_test "print i_" "\\\$1 = 3" "check the member variable"
gdb_test "continue" ".*Breakpoint.*C1::bar.*" "continue to breakpoint"
gdb_test "print i_" "\\\$2 = 3" "check the member variable"
+# PR c++/17059
+gdb_breakpoint "C1::method_with_opaque (opaque_struct *)" message
gdb_exit
return 0