Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShuai Li2015-11-27 09:39:49 -0500
committerShuai Li2015-11-30 03:35:59 -0500
commitefd61446afd09ef73603155a6420ead2ab01bae2 (patch)
tree610167b08bbc565ad46294da5b3babfe51912867
parent1a51e1c537799fa0a0fa3b239fdd37580b2b9439 (diff)
downloadorg.eclipse.papyrus-efd61446afd09ef73603155a6420ead2ab01bae2.tar.gz
org.eclipse.papyrus-efd61446afd09ef73603155a6420ead2ab01bae2.tar.xz
org.eclipse.papyrus-efd61446afd09ef73603155a6420ead2ab01bae2.zip
Bug 481296 - [C++ codegen] Initialization of static const member of a
class - Add "const" in front of static const variable initialization in body file Signed-off-by: Shuai Li <shuai.li@cea.fr>
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend2
-rw-r--r--tests/junit/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.tests/ExpectedModel/Class4.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend
index 35305e4427d..9324fe993b2 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend
@@ -70,7 +70,7 @@ class CppAttribute {
static def CppStaticAttributeImplementation(Property attribute) '''
«CppDocumentation.CppElementDoc(attribute)»
- «CppGenUtils.cppQualifiedName(attribute.type)»«Modifier.modPtr(attribute)»«Modifier.modRef(attribute)» «attribute.class_.name»::«attribute.name»«Modifier.modArray(attribute)»«defaultValue(attribute)»;
+ «Modifier.modCVQualifier(attribute)» «CppGenUtils.cppQualifiedName(attribute.type)»«Modifier.modPtr(attribute)»«Modifier.modRef(attribute)» «attribute.class_.name»::«attribute.name»«Modifier.modArray(attribute)»«defaultValue(attribute)»;
'''
static def defaultValue(Property attribute) {
diff --git a/tests/junit/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.tests/ExpectedModel/Class4.cpp b/tests/junit/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.tests/ExpectedModel/Class4.cpp
index 15864cc6697..e27afac327d 100644
--- a/tests/junit/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.tests/ExpectedModel/Class4.cpp
+++ b/tests/junit/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.tests/ExpectedModel/Class4.cpp
@@ -21,7 +21,7 @@ char* Class4::charStringStaticInit = "Hello World";
/**
*
*/
-char* Class4::charStringStaticConstInit = "Hello World";
+const char* Class4::charStringStaticConstInit = "Hello World";
/************************************************************
End of Class4 class body

Back to the top