Files
clang-p2996/clang/test/ParserHLSL/invalid_inside_cb.hlsl
Chris B 2222e27d9e [HLSL] Add HLSL 202y language mode (#108437)
This change adds a new HLSL 202y language mode. Currently HLSL 202y is
planned to add `auto` and `constexpr`.

This change updates extension diagnostics to state that lambadas are a
"clang HLSL" extension (since we have no planned release yet to include
them), and that `auto` is a HLSL 202y extension when used in earlier
language modes.

Note: This PR does temporarily work around some differences between HLSL
2021 and 202x in Clang by changing test cases to explicitly specify
202x. A subsequent PR will update 2021's language flags to match 202x.
2024-09-13 16:11:19 -05:00

21 lines
547 B
HLSL

// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -std=hlsl202x -o - -fsyntax-only %s -verify
// template not allowed inside cbuffer.
cbuffer A {
// expected-error@+2 {{invalid declaration inside cbuffer}}
template<typename T>
T foo(T t) { return t;}
}
cbuffer A {
// expected-error@+2 {{invalid declaration inside cbuffer}}
template<typename T>
struct S { float s;};
}
// typealias not allowed inside cbuffer.
cbuffer A {
// expected-error@+1 {{invalid declaration inside cbuffer}}
using F32 = float;
}