82 lines · plain
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -o - -fsyntax-only %s -verify2 3// expected-error@+1 {{pointers are unsupported in HLSL}}4typedef int (*fn_int)(int);5void* bark(int); // expected-error {{pointers are unsupported in HLSL}}6void meow(int*); // expected-error {{pointers are unsupported in HLSL}}7 8struct Foo {9 int X;10 int Y;11} *bad; // expected-error {{pointers are unsupported in HLSL}}12 13// expected-error@+1 {{pointers are unsupported in HLSL}}14void woof(int Foo::*Member);15 16int entry() {17 int X;18 Foo F;19 20 // expected-error@+2 {{the '&' operator is unsupported in HLSL}}21 // expected-error@+1 {{pointers are unsupported in HLSL}}22 int Foo::*Member = &F.X;23 24 25 // expected-error@+1 {{the '&' operator is unsupported in HLSL}}26 int *Y = &X; // expected-error {{pointers are unsupported in HLSL}}27 28 // expected-error@+2 {{the '->' operator is unsupported in HLSL}}29 // expected-error@+1 {{the '&' operator is unsupported in HLSL}}30 int W = (&F)->X;31 32 int Array[2];33 // expected-error@+1 {{the '&' operator is unsupported in HLSL}}34 *(&Array[0] + 1) = 12;35 // expected-error@+1 {{the '*' operator is unsupported in HLSL}}36 *Array = 12;37}38 39int roar(Foo *F) { // expected-error {{pointers are unsupported in HLSL}}40 // expected-error@+1 {{the '->' operator is unsupported in HLSL}}41 return F->X;42}43 44template <typename T>45void devilish_language(T look_ma_no_pointers);46 47void make_me_cry() {48 int X;49 // expected-error@+1 {{the '&' operator is unsupported in HLSL}}50 devilish_language(&X);51 52 // not-expected-error@+1 {{pointers are unsupported in HLSL}}53 devilish_language(roar); // allow function pointer decay54 55 // not-expected-error@+1 {{pointers are unsupported in HLSL}}56 devilish_language("roar"); // allow array pointer decay57}58 59struct Fish {60 struct Fins {61 int Left;62 int Right;63 };64 int X;65 int operator *() {66 return X;67 }68 69 // expected-note@+1 {{'->' applied to return value of the operator->() declared here}}70 Fins operator ->() {71 return Fins();72 }73};74 75int gone_fishing() {76 Fish F;77 int Result = *F; // user-defined dereference operators work78 // expected-error@+1 {{member reference type 'Fins' is not a pointer}}79 Result += F->Left;80 return Result;81}82