summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/losparam.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2012-01-01 08:23:50 -0500
committerNeil Moore <neil@s-z.org>2012-01-01 08:23:50 -0500
commit3f8632fd047158de12f1dab8dc9e0faa4aa1996b (patch)
tree0fe4e07ed32a256895dcf99419b5544e9e010424 /crawl-ref/source/losparam.cc
parent780e22fe3a7a1fb4744acc6b6f8f6433ff88c2fb (diff)
downloadcrawl-ref-3f8632fd047158de12f1dab8dc9e0faa4aa1996b.tar.gz
crawl-ref-3f8632fd047158de12f1dab8dc9e0faa4aa1996b.zip
Fix a standards compliance issue.
Per C++11 section 8.5 paragraph 6, a const object cannot be default- initialised unless it belongs to a class with a user-provided default constructor. The opc_* constants are const and belong to a class without an explicit default constructor. Therefore, value-initialise them instead. Most compilers, including latest gcc, will happily accept this construct. However, there was a period during which gcc 4.6 issued a diagnostic (and, without -fpermissive, an error). In particular, this has been reported in gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1, though it is accepted without warning in gcc (Debian 4.6.1-14) 4.6.1.
Diffstat (limited to 'crawl-ref/source/losparam.cc')
-rw-r--r--crawl-ref/source/losparam.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc
index d92f4deb98..f7727b9b2d 100644
--- a/crawl-ref/source/losparam.cc
+++ b/crawl-ref/source/losparam.cc
@@ -14,13 +14,13 @@
#include "state.h"
#include "terrain.h"
-const opacity_default opc_default;
-const opacity_fullyopaque opc_fullyopaque;
-const opacity_no_trans opc_no_trans;
-const opacity_immob opc_immob;
-const opacity_solid opc_solid;
-const opacity_solid_see opc_solid_see;
-const opacity_no_actor opc_no_actor;
+const opacity_default opc_default = opacity_default();
+const opacity_fullyopaque opc_fullyopaque = opacity_fullyopaque();
+const opacity_no_trans opc_no_trans = opacity_no_trans();
+const opacity_immob opc_immob = opacity_immob();
+const opacity_solid opc_solid = opacity_solid();
+const opacity_solid_see opc_solid_see = opacity_solid_see();
+const opacity_no_actor opc_no_actor = opacity_no_actor();
opacity_type opacity_default::operator()(const coord_def& p) const
{