diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-23 01:35:27 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-23 01:35:27 +0000 |
commit | 1e9402cb3d04add863c5f662b346c8f5f180ebb7 (patch) | |
tree | cb145c717f1c276fe843b951b6524a08004d8194 /gcc/go/gofrontend/gogo.cc | |
parent | 9d65de21235ee355ae15350fb119a5be371edb4b (diff) | |
download | gcc-1e9402cb3d04add863c5f662b346c8f5f180ebb7.zip gcc-1e9402cb3d04add863c5f662b346c8f5f180ebb7.tar.gz gcc-1e9402cb3d04add863c5f662b346c8f5f180ebb7.tar.bz2 |
A variable with a preinit block requires an intialization function.
From-SVN: r168198
Diffstat (limited to 'gcc/go/gofrontend/gogo.cc')
-rw-r--r-- | gcc/go/gofrontend/gogo.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index aa62ce6..9e51b63 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -1384,7 +1384,11 @@ Gogo::determine_types() // If this is a global variable which requires runtime // initialization, we need an initialization function. - if (!variable->is_global() || variable->init() == NULL) + if (!variable->is_global()) + ; + else if (variable->has_pre_init()) + this->need_init_fn_ = true; + else if (variable->init() == NULL) ; else if (variable->type()->interface_type() != NULL) this->need_init_fn_ = true; |