diff options
Diffstat (limited to 'test/SemaCXX/overloaded-operator.cpp')
-rw-r--r-- | test/SemaCXX/overloaded-operator.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp index 7762667..16d3704 100644 --- a/test/SemaCXX/overloaded-operator.cpp +++ b/test/SemaCXX/overloaded-operator.cpp @@ -286,3 +286,41 @@ class RegAlloc { } int usepri[LastReg + 1]; }; + +// PR5546: Don't generate incorrect and ambiguous overloads for multi-level +// arrays. +namespace pr5546 +{ + enum { X }; + extern const char *const sMoveCommands[][2][2]; + const char* a() { return sMoveCommands[X][0][0]; } + const char* b() { return (*(sMoveCommands+X))[0][0]; } +} + +// PR5512 and its discussion +namespace pr5512 { + struct Y { + operator short(); + operator float(); + }; + void g_test(Y y) { + short s = 0; + // DR507, this should be ambiguous, but we special-case assignment + s = y; + // Note: DR507, this is ambiguous as specified + //s += y; + } + + struct S {}; + void operator +=(int&, S); + void f(S s) { + int i = 0; + i += s; + } + + struct A {operator int();}; + int a; + void b(A x) { + a += x; + } +} |