34 lines · cpp
1// RUN: not %clang_cc1 -std=c++20 -fdiagnostics-parseable-fixits -x c++ %s 2> %t2// RUN: FileCheck %s < %t3 4template<typename T>5concept UnaryC = true;6template<typename T, typename U>7concept BinaryC = true;8 9struct S{ int i, j; };10S get_S();11 12template<typename T>13T get_T();14 15void use() {16 UnaryC auto [a, b] = get_S();17 // CHECK: error: structured binding declaration cannot be declared with constrained 'auto'18 // CHECK: fix-it:{{.*}}:{16:3-16:10}:""19 BinaryC<int> auto [c, d] = get_S();20 // CHECK: error: structured binding declaration cannot be declared with constrained 'auto'21 // CHECK: fix-it:{{.*}}:{19:3-19:16}:""22}23 24template<typename T>25void TemplUse() {26 UnaryC auto [a, b] = get_T<T>();27 // CHECK: error: structured binding declaration cannot be declared with constrained 'auto'28 // XCHECK: fix-it:{{.*}}:{26:3-26:10}:""29 BinaryC<T> auto [c, d] = get_T<T>();30 // CHECK: error: structured binding declaration cannot be declared with constrained 'auto'31 // XCHECK: fix-it:{{.*}}:{29:3-29:14}:""32}33 34