summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Wesolowski2011-07-15 21:08:11 (EDT)
committerAlena Laskavaia2011-07-15 21:13:03 (EDT)
commit761ccb9301f63f439aad89ef060775369ef917a0 (patch)
tree40cac4f2e3647b74e8b716e655a67b5b0bfdbb19
parent63f72f39e12c968bbfe3ec7c158de43936ec48de (diff)
downloadorg.eclipse.cdt-761ccb9301f63f439aad89ef060775369ef917a0.zip
org.eclipse.cdt-761ccb9301f63f439aad89ef060775369ef917a0.tar.gz
org.eclipse.cdt-761ccb9301f63f439aad89ef060775369ef917a0.tar.bz2
Bug 333599 - [C++0x] Initializer lists & return without type
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java2
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java9
2 files changed, 10 insertions, 1 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
index f7bc5fc..dd9ef6d 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
@@ -93,7 +93,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
public int visit(IASTStatement stmt) {
if (stmt instanceof IASTReturnStatement) {
IASTReturnStatement ret = (IASTReturnStatement) stmt;
- boolean hasValue = ret.getReturnValue() != null;
+ boolean hasValue = ret.getReturnArgument() != null;
if (hasret == false && hasValue) {
hasret = true;
}
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
index 09ec9f4..9a09a8c 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
@@ -289,4 +289,13 @@ public class ReturnCheckerTest extends CheckerTestCase {
loadCodeAndRunCpp(getAboveComment());
checkNoErrors();
}
+
+ // #include <vector>
+ // std::vector<int> f() {
+ // return {1,2,3};
+ // }
+ public void testReturnInitializerList() {
+ loadCodeAndRunCpp(getAboveComment());
+ checkNoErrors();
+ }
} \ No newline at end of file