27 lines · cpp
1// RUN: %clang_cc1 -fenable-matrix -fsyntax-only -verify %s -std=c++112 3using Matrix = int __attribute__((matrix_type(4, 3)));4 5template <__SIZE_TYPE__ a, __SIZE_TYPE__ b>6using TMatrix = int __attribute__((matrix_type(a, b)));7 8struct S {9 void* operator new(__SIZE_TYPE__, int);10 void* operator new(__SIZE_TYPE__, Matrix);11 void* operator new(__SIZE_TYPE__, TMatrix<2, 2>);12};13 14int main() {15 Matrix m;16 TMatrix<2, 2> tm;17 18 new (m) S {};19 new (tm) S {};20 21 new (m[1][1]) S {};22 new (tm[1][1]) S {};23 24 new (m[1]) S {}; // expected-error {{single subscript expressions are not allowed for matrix values}}25 new (tm[1]) S {}; // expected-error {{single subscript expressions are not allowed for matrix values}}26}27