if (debug_compile_cplus_scopes)
printf_unfiltered ("leaving scope %p\n", current);
- /* Pop namespaces. Do not push the last scope_component -- that's
- the type we are converting, not a namespace. */
+ /* Pop namespaces. */
std::for_each
(current.begin (),current.end () - 1, [this] (const auto &comp) {
gdb_assert (TYPE_CODE (SYMBOL_TYPE (comp.bsymbol.symbol))
if (TYPE_NAME (type) != NULL)
name = cp_func_name (TYPE_NAME (type));
- else
- name = xstrdup (""); // !!keiths: anonymous namespace?!
/* Push scope. */
instance->enter_scope (scope);
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-static enum {ABC = 1, DEF, GHI, JKL} anon_e = GHI;
-static union
-{
- char aa;
- int bb;
- float ff;
- double dd;
- void *pp;
-} anon_u = { 'a' };
-
-static struct
-{
- char *ptr;
- int len;
-} anon_s = {"abracadabra", 11};
-
-struct A
-{
- A (void) : e (AA)
+namespace {
+ static enum {ABC = 1, DEF, GHI, JKL} anon_e = GHI;
+ static union
{
- this->u.b = 0;
- this->s.ptr = "hello";
- this->s.len = 5;
- }
+ char aa;
+ int bb;
+ float ff;
+ double dd;
+ void *pp;
+ } anon_u = { 'a' };
- enum {AA = 10, BB, CC, DD} e;
- union
- {
- char a;
- int b;
- float f;
- double d;
- void *p;
- } u;
- struct
+ static struct
{
char *ptr;
int len;
- } s;
+ struct
+ {
+ unsigned MAGIC;
+ };
+ union
+ {
+ int ua;
+ char *ub;
+ };
+ } anon_s = {"abracadabra", 11, 0xdead, 0xbeef};
+
+ struct A
+ {
+ A (void) : e (AA)
+ {
+ this->u.b = 0;
+ this->s.ptr = "hello";
+ this->s.len = 5;
+ }
+
+ enum {AA = 10, BB, CC, DD} e;
+ union
+ {
+ char a;
+ int b;
+ float f;
+ double d;
+ void *p;
+ } u;
+ struct
+ {
+ char *ptr;
+ int len;
+ } s;
+ };
};
int
CompileExpression::test "anon_e" {(3|GHI)}
CompileExpression::test "anon_u.aa" {97( 'a')?}
CompileExpression::test "anon_s.len" 11
+CompileExpression::test "anon_s.MAGIC" "57005"
+CompileExpression::test "anon_s.ua" "48879"
CompileExpression::test "a.u.b" 0
CompileExpression::test "a.s.len" 5
CompileExpression::test "a.e" {(10|A::AA)}