Fixes compilation of incorrect code:
const f, g = g, f
func S() []byte { return []byte(f) }
The problem was already handled for numerical constants.
Part of issue 3186 (go).
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@186512
138bc75d-0d04-0410-961f-
82ee72b054a4
do_numeric_constant_value(Numeric_constant* nc) const;
bool
- do_string_constant_value(std::string* val) const
- { return this->constant_->const_value()->expr()->string_constant_value(val); }
+ do_string_constant_value(std::string* val) const;
Type*
do_type();
return r;
}
+bool
+Const_expression::do_string_constant_value(std::string* val) const
+{
+ if (this->seen_)
+ return false;
+
+ Expression* e = this->constant_->const_value()->expr();
+
+ this->seen_ = true;
+ bool ok = e->string_constant_value(val);
+ this->seen_ = false;
+
+ return ok;
+}
+
// Return the type of the const reference.
Type*