xref: /llvm-project/clang/test/FixIt/fixit-static-assert.cpp (revision 95f50964fbf59dc6394898c0719ce8772cc24d25)
1*5616c5b8SNathan James // RUN: %clang_cc1 -std=c++14 %s -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
2*5616c5b8SNathan James // Ensure no warnings are emitted in c++17.
3*5616c5b8SNathan James // RUN: %clang_cc1 -std=c++17 %s -verify=cxx17
4*5616c5b8SNathan James // RUN: %clang_cc1 -std=c++14 %s -fixit-recompile -fixit-to-temporary -Werror
5*5616c5b8SNathan James 
6*5616c5b8SNathan James // cxx17-no-diagnostics
7*5616c5b8SNathan James 
8*5616c5b8SNathan James static_assert(true && "String");
9*5616c5b8SNathan James // CHECK-DAG: {[[@LINE-1]]:20-[[@LINE-1]]:22}:","
10*5616c5b8SNathan James 
11*5616c5b8SNathan James // String literal prefixes are good.
12*5616c5b8SNathan James static_assert(true && R"(RawString)");
13*5616c5b8SNathan James // CHECK-DAG: {[[@LINE-1]]:20-[[@LINE-1]]:22}:","
14*5616c5b8SNathan James 
15*5616c5b8SNathan James static_assert(true);
16*5616c5b8SNathan James // CHECK-DAG: {[[@LINE-1]]:19-[[@LINE-1]]:19}:", \"\""
17*5616c5b8SNathan James 
18*5616c5b8SNathan James // While its technically possible to transform this to
19*5616c5b8SNathan James // static_assert(true, "String") we don't attempt this fix.
20*5616c5b8SNathan James static_assert("String" && true);
21*5616c5b8SNathan James // CHECK-DAG: {[[@LINE-1]]:31-[[@LINE-1]]:31}:", \"\""
22*5616c5b8SNathan James 
23*5616c5b8SNathan James // Don't be smart and look in parentheses.
24*5616c5b8SNathan James static_assert((true && "String"));
25*5616c5b8SNathan James // CHECK-DAG: {[[@LINE-1]]:33-[[@LINE-1]]:33}:", \"\""
26