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
2e92d7ad
Commit
2e92d7ad
authored
Mar 16, 2017
by
Jason Merrill
Committed by
Jason Merrill
Mar 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* decl.c (start_enum): std::byte aliases anything.
From-SVN: r246212
parent
85e653c9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
+39
-0
gcc/cp/ChangeLog
+2
-0
gcc/cp/decl.c
+6
-0
gcc/testsuite/g++.dg/cpp1z/byte1.C
+31
-0
No files found.
gcc/cp/ChangeLog
View file @
2e92d7ad
2017-03-16 Jason Merrill <jason@redhat.com>
* decl.c (start_enum): std::byte aliases anything.
PR c++/79797
* constexpr.c (lookup_placeholder): Tweak.
...
...
gcc/cp/decl.c
View file @
2e92d7ad
...
...
@@ -14079,6 +14079,12 @@ start_enum (tree name, tree enumtype, tree underlying_type,
{
enumtype
=
cxx_make_type
(
ENUMERAL_TYPE
);
enumtype
=
pushtag
(
name
,
enumtype
,
/*tag_scope=*/
ts_current
);
/* std::byte aliases anything. */
if
(
enumtype
!=
error_mark_node
&&
TYPE_CONTEXT
(
enumtype
)
==
std_node
&&
!
strcmp
(
"byte"
,
TYPE_NAME_STRING
(
enumtype
)))
TYPE_ALIAS_SET
(
enumtype
)
=
0
;
}
else
enumtype
=
xref_tag
(
enum_type
,
name
,
/*tag_scope=*/
ts_current
,
...
...
gcc/testsuite/g++.dg/cpp1z/byte1.C
0 → 100644
View file @
2e92d7ad
// Test for std::byte aliasing properties.
// { dg-options "-std=c++1z -O3" }
#include <cstddef>
using
byte
=
std
::
byte
;
enum
class
notbyte
:
unsigned
char
{}
*
np
;
int
main
()
{
int
x
;
/* Stores through byte* can alias int, so the compiler can't optimize
"x != 0". */
byte
*
p
=
(
byte
*
)
&
x
;
x
=
42
;
for
(
int
i
=
0
;
i
<
4
;
++
i
)
p
[
i
]
=
byte
(
0
);
if
(
x
!=
0
)
__builtin_abort
();
/* Stores through notbyte* mustn't alias int, so at -O3 the compiler should
optimize "x != 42" to false. */
notbyte
*
np
=
(
notbyte
*
)
&
x
;
x
=
42
;
for
(
int
i
=
0
;
i
<
4
;
++
i
)
np
[
i
]
=
notbyte
(
0
);
if
(
x
!=
42
)
__builtin_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