1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 510665 - User-defined literal operator in namespace

Change-Id: Idb93eac23caa16870040cd4092f24a4a02563251
This commit is contained in:
Nathan Ridge 2017-01-19 22:02:31 -05:00
parent 09476c126a
commit a3b4bc6852
2 changed files with 15 additions and 1 deletions

View file

@ -11870,6 +11870,19 @@ public class AST2CPPTests extends AST2TestBase {
assertTrue(test.getType() instanceof IProblemType); // resolution is ambiguous assertTrue(test.getType() instanceof IProblemType); // resolution is ambiguous
} }
// namespace N {
// class Color {};
// Color operator"" _color(const char*, unsigned long);
// }
// void setColor(N::Color);
// int main() {
// using namespace N;
// setColor("#ffffff"_color); // ERROR
// }
public void testUserDefinedLiteralInNamespace_510665() throws Exception {
parseAndCheckBindings();
}
// double waldo1 = 02.968; // double waldo1 = 02.968;
// double waldo2 = 09.268; // double waldo2 = 09.268;
// double waldo3 = 02e2; // double waldo3 = 02e2;

View file

@ -3181,7 +3181,8 @@ public class CPPSemantics {
* *
*/ */
int kind = exp.getKind(); int kind = exp.getKind();
IBinding[] bindings = findBindings(exp.getTranslationUnit().getScope(), ((CPPASTLiteralExpression) exp).getOperatorName(), false); IScope lookupScope = CPPVisitor.getContainingScope(exp);
IBinding[] bindings = findBindings(lookupScope, ((CPPASTLiteralExpression) exp).getOperatorName(), false);
ICPPFunction[] funcs = new ICPPFunction[bindings.length]; ICPPFunction[] funcs = new ICPPFunction[bindings.length];
ICPPFunctionTemplate[] tplFunctions = new ICPPFunctionTemplate[bindings.length]; ICPPFunctionTemplate[] tplFunctions = new ICPPFunctionTemplate[bindings.length];
LookupData data = new LookupData(((CPPASTLiteralExpression) exp).getOperatorName(), null, exp); LookupData data = new LookupData(((CPPASTLiteralExpression) exp).getOperatorName(), null, exp);