Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
5bf5c5cb
Commit
5bf5c5cb
authored
May 14, 2002
by
Jason Merrill
Committed by
Alexandre Oliva
May 14, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* g++.dg/init/pm1.C: New test.
From-SVN: r53462
parent
94e6e4c4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
0 deletions
+92
-0
gcc/testsuite/ChangeLog
+4
-0
gcc/testsuite/g++.dg/init/pm1.C
+88
-0
No files found.
gcc/testsuite/ChangeLog
View file @
5bf5c5cb
2002-05-14 Jason Merrill <jason@redhat.com>, Alexandre Oliva <aoliva@redhat.com>
* g++.dg/init/pm1.C: New test.
2002-05-12 David S. Miller <davem@redhat.com>
* gcc.c-torture/execute/conversion.c (ldnear): Use long double
...
...
gcc/testsuite/g++.dg/init/pm1.C
0 → 100644
View file @
5bf5c5cb
// { dg-do run }
// Copyright 2002 Free Software Foundation
// Contributed by Jason Merrill and Alexandre Oliva
// Test zero-initialization of pointers to data members. Their NULL
// value is represented with -1, not 0.
#include <stdlib.h>
struct
A
{
int
i
;
};
int
A
::*
gp
;
typedef
int
A
::*
iApm
;
iApm
gp_zero
=
0
;
iApm
gp_dflt
=
iApm
();
iApm
gp_cast
=
(
iApm
)
0
;
iApm
gp_func
=
iApm
(
0
);
iApm
gp_stat
=
static_cast
<
iApm
>
(
0
);
struct
AD
:
A
{};
int
AD
::*
gp_impl
=
gp_dflt
;
int
AD
::*
gp_down
=
static_cast
<
int
AD
::*>
(
gp_stat
);
int
A
::*
ga
[
2
];
// Test use in a simple struct.
struct
B
{
int
A
::*
mp
;
};
B
gb
;
struct
D
;
struct
C
;
extern
D
gd
;
extern
C
gc
;
// Test that in a class with a constructor, the pointer to member is
// zero-initialized until the constructor is run.
struct
C
{
int
A
::*
mp
;
inline
C
();
};
int
fail
;
struct
D
{
int
count
;
inline
D
();
};
C
::
C
()
:
mp
(
&
A
::
i
)
{
gd
.
count
++
;
}
D
::
D
()
:
count
(
0
)
{
if
(
gc
.
mp
!=
0
)
abort
();
}
// The D must come first for this to work.
D
gd
;
C
gc
;
int
main
()
{
static
int
A
::*
slp
;
static
int
A
::*
sla
[
2
];
static
B
slb
;
if
(
gp
!=
0
||
slp
!=
0
||
gp_zero
!=
0
||
gp_dflt
!=
0
||
gp_cast
!=
0
||
gp_func
!=
0
||
gp_stat
!=
0
||
gp_impl
!=
0
||
gp_down
!=
0
)
abort
();
if
(
ga
[
1
]
!=
0
||
sla
[
1
]
!=
0
)
abort
();
if
(
gb
.
mp
!=
0
||
slb
.
mp
!=
0
)
abort
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment