Skip to main content
summaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorNathan Ridge2015-12-17 23:50:14 -0500
committerSergey Prigogin2015-12-23 23:30:15 -0500
commit59de5c303fa4acb288a734742afc6ea017579225 (patch)
tree6e35d056a80ee9dc5a074dc9949743ce69bb423a /codan
parent8ceb33a1fcff181faaaede0887780dc81ee1d10f (diff)
downloadorg.eclipse.cdt-59de5c303fa4acb288a734742afc6ea017579225.tar.gz
org.eclipse.cdt-59de5c303fa4acb288a734742afc6ea017579225.tar.xz
org.eclipse.cdt-59de5c303fa4acb288a734742afc6ea017579225.zip
Bug 484619 - Make sure ProblemBindingChecker reports unresolved
user-defined literal operators Change-Id: Idbb157c33b3aae06a00a10f7e7836e96db9f9b63 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ProblemBindingChecker.java4
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ProblemBindingCheckerTest.java14
2 files changed, 18 insertions, 0 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ProblemBindingChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ProblemBindingChecker.java
index 75e2ecba21..a309e728b5 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ProblemBindingChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ProblemBindingChecker.java
@@ -35,6 +35,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclarator;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
@@ -245,6 +246,9 @@ public class ProblemBindingChecker extends AbstractIndexAstChecker {
}
} else if (parentNode instanceof ICPPASTDeclarator && name instanceof IASTImplicitName) {
return true;
+ } else if (parentNode instanceof ICPPASTLiteralExpression && name instanceof IASTImplicitName) {
+ // Implicit name for user-defined literal operator.
+ return true;
}
return false;
}
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ProblemBindingCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ProblemBindingCheckerTest.java
index 3e250a259c..67cbccdada 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ProblemBindingCheckerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ProblemBindingCheckerTest.java
@@ -95,4 +95,18 @@ public class ProblemBindingCheckerTest extends CheckerTestCase {
IMarker marker = checkErrorLine(3, ProblemBindingChecker.ERR_ID_FunctionResolutionProblem);
assertFalse(marker.getAttribute(IMarker.MESSAGE, "").contains("MACRO")); //$NON-NLS-1$//$NON-NLS-2$
}
+
+ // auto d = 42_waldo;
+ public void testNonexistentUDLOperator_484619() {
+ loadCodeAndRun(getAboveComment());
+ checkErrorLine(1, ProblemBindingChecker.ERR_ID_FunctionResolutionProblem);
+ }
+
+ // struct R {};
+ // R operator "" _waldo(const char*, unsigned long); // expects a string literal
+ // auto d = 42_waldo; // passing an integer
+ public void testUDLOperatorWithWrongType_484619() {
+ loadCodeAndRun(getAboveComment());
+ checkErrorLine(3, ProblemBindingChecker.ERR_ID_InvalidArguments);
+ }
}

Back to the top