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
e7d9342c
Commit
e7d9342c
authored
Oct 10, 2013
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: A type conversion of a constant is not always a constant.
From-SVN: r203332
parent
215552ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
gcc/go/gofrontend/expressions.cc
+22
-2
No files found.
gcc/go/gofrontend/expressions.cc
View file @
e7d9342c
...
...
@@ -3055,8 +3055,7 @@ class Type_conversion_expression : public Expression
do_lower
(
Gogo
*
,
Named_object
*
,
Statement_inserter
*
,
int
);
bool
do_is_constant
()
const
{
return
this
->
expr_
->
is_constant
();
}
do_is_constant
()
const
;
bool
do_numeric_constant_value
(
Numeric_constant
*
)
const
;
...
...
@@ -3198,6 +3197,27 @@ Type_conversion_expression::do_lower(Gogo*, Named_object*,
return
this
;
}
// Return whether a type conversion is a constant.
bool
Type_conversion_expression
::
do_is_constant
()
const
{
if
(
!
this
->
expr_
->
is_constant
())
return
false
;
// A conversion to a type that may not be used as a constant is not
// a constant. For example, []byte(nil).
Type
*
type
=
this
->
type_
;
if
(
type
->
integer_type
()
==
NULL
&&
type
->
float_type
()
==
NULL
&&
type
->
complex_type
()
==
NULL
&&
!
type
->
is_boolean_type
()
&&
!
type
->
is_string_type
())
return
false
;
return
true
;
}
// Return the constant numeric value if there is one.
bool
...
...
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