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
2f8ec491
Commit
2f8ec491
authored
May 03, 1999
by
Mark Mitchell
Committed by
Mark Mitchell
May 03, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* typeck.c (build_const_cast): Tighten checks for legality.
From-SVN: r26753
parent
d750f6f7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
gcc/cp/ChangeLog
+4
-0
gcc/cp/typeck.c
+8
-2
gcc/testsuite/g++.old-deja/g++.other/cast2.C
+6
-0
No files found.
gcc/cp/ChangeLog
View file @
2f8ec491
1999-05-03 Mark Mitchell <mark@codesourcery.com>
* typeck.c (build_const_cast): Tighten checks for legality.
1999-05-02 Martin von Lwis <loewis@informatik.hu-berlin.de>
1999-05-02 Martin von Lwis <loewis@informatik.hu-berlin.de>
* init.c (build_member_call): Lookup names coming from
* init.c (build_member_call): Lookup names coming from
...
...
gcc/cp/typeck.c
View file @
2f8ec491
...
@@ -5643,11 +5643,17 @@ build_const_cast (type, expr)
...
@@ -5643,11 +5643,17 @@ build_const_cast (type, expr)
return
t
;
return
t
;
}
}
if
(
!
POINTER_TYPE_P
(
type
)
&&
!
TYPE_PTRMEMFUNC_P
(
type
)
)
if
(
!
POINTER_TYPE_P
(
type
))
{
{
cp_error
(
"`%T' is not a pointer, reference, or pointer-to-member type"
,
cp_error
(
"`%T' is not a pointer, reference, or pointer-to-
data-
member type"
,
type
);
type
);
cp_error
(
"as required by const_cast"
);
cp_error
(
"as required by const_cast"
);
}
else
if
(
TREE_CODE
(
TREE_TYPE
(
type
))
==
FUNCTION_TYPE
)
{
cp_error
(
"`%T' is a pointer or reference to a function type"
,
type
);
cp_error
(
"which is forbidden by const_cast"
);
return
error_mark_node
;
return
error_mark_node
;
}
}
...
...
gcc/testsuite/g++.old-deja/g++.other/cast2.C
View file @
2f8ec491
...
@@ -7,5 +7,11 @@ struct A {
...
@@ -7,5 +7,11 @@ struct A {
int
main
()
int
main
()
{
{
A
a
;
A
a
;
typedef
void
(
A
::*
F
)();
F
p
;
const_cast
<
const
A
>
(
a
);
// ERROR - const_cast requires pointer/ref types
const_cast
<
const
A
>
(
a
);
// ERROR - const_cast requires pointer/ref types
const_cast
<
F
>
(
p
);
// ERROR - const_cast requires pointer/ref types
const_cast
<
int
(
*
)()
>
(
&
main
);
// ERROR - function type in const_cast
const_cast
<
int
(
&
)()
>
(
main
);
// ERROR - function type in const_cast
}
}
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