2013-01-17 Pedro Alves <palves@redhat.com>
[deliverable/binutils-gdb.git] / gdb / c-exp.y
index 2c6eedaac25f4817e7af06ab98f675b3e9867eb0..984712047b316d7b4f228857cd4bc756ac1bbbec 100644 (file)
@@ -1,6 +1,5 @@
 /* YACC parser for C expressions, for GDB.
-   Copyright (C) 1986, 1989-2000, 2003-2004, 2006-2012 Free Software
-   Foundation, Inc.
+   Copyright (C) 1986-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -55,6 +54,7 @@
 #include "macroscope.h"
 #include "objc-lang.h"
 #include "typeprint.h"
+#include "cp-abi.h"
 
 #define parse_type builtin_type (parse_gdbarch)
 
@@ -2780,6 +2780,26 @@ classify_name (const struct block *block)
          yylval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
          return FILENAME;
        }
+
+      /* If we found a field of 'this', we might have erroneously
+        found a constructor where we wanted a type name.  Handle this
+        case by noticing that we found a constructor and then look up
+        the type tag instead.  */
+      if (is_a_field_of_this.type != NULL
+         && is_a_field_of_this.fn_field != NULL
+         && TYPE_FN_FIELD_CONSTRUCTOR (is_a_field_of_this.fn_field->fn_fields,
+                                       0))
+       {
+         struct field_of_this_result inner_is_a_field_of_this;
+
+         sym = lookup_symbol (copy, block, STRUCT_DOMAIN,
+                              &inner_is_a_field_of_this);
+         if (sym != NULL)
+           {
+             yylval.tsym.type = SYMBOL_TYPE (sym);
+             return TYPENAME;
+           }
+       }
     }
 
   if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
This page took 0.024743 seconds and 4 git commands to generate.