Files
clang-p2996/clang/test/SemaHLSL/prohibit_reference.hlsl
Chris Bieneman 3efad612d2 [HLSL] Pointers are unsupported in HLSL
HLSL does not support pointers or references. This change generates
errors in sema for generating pointer, and reference types as well as
common operators (address-of, dereference, arrow), which are used with
pointers and are unsupported in HLSL.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D123167
2022-04-14 13:32:51 -05:00

21 lines
613 B
HLSL

// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - -fsyntax-only %s -verify
int& bark(int); // expected-error {{references are unsupported in HLSL}}
void meow(int&); // expected-error {{references are unsupported in HLSL}}
void chirp(int &&); // expected-error {{references are unsupported in HLSL}}
// expected-warning@-1 {{rvalue references are a C++11 extension}}
struct Foo {
int X;
int Y;
};
int entry() {
int X;
int &Y = X; // expected-error {{references are unsupported in HLSL}}
}
int roar(Foo &F) { // expected-error {{references are unsupported in HLSL}}
return F.X;
}