diff options
Diffstat (limited to 'test/CXX/drs/dr12xx.cpp')
-rw-r--r-- | test/CXX/drs/dr12xx.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/CXX/drs/dr12xx.cpp b/test/CXX/drs/dr12xx.cpp index 24039a1cd240..1bc4c3973443 100644 --- a/test/CXX/drs/dr12xx.cpp +++ b/test/CXX/drs/dr12xx.cpp @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -namespace dr1213 { // dr1213: 4 +namespace dr1213 { // dr1213: 7 #if __cplusplus >= 201103L using T = int[3]; int &&r = T{}[1]; @@ -11,6 +11,19 @@ namespace dr1213 { // dr1213: 4 using T = decltype((T{})); using U = decltype((T{}[2])); using U = int &&; + + // Same thing but in a case where we consider overloaded operator[]. + struct ConvertsToInt { + operator int(); + }; + struct X { int array[1]; }; + using U = decltype(X().array[ConvertsToInt()]); + + // We apply the same rule to vector subscripting. + typedef int V4Int __attribute__((__vector_size__(sizeof(int) * 4))); + typedef int EV4Int __attribute__((__ext_vector_type__(4))); + using U = decltype(V4Int()[0]); + using U = decltype(EV4Int()[0]); #endif } |