summaryrefslogtreecommitdiff
path: root/tests/diagnostics/arrow-operator.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-03-21 17:19:03 -0700
committerGitHub <noreply@github.com>2024-03-21 17:19:03 -0700
commit7a8ef896196ad0d7095412d8558dd9a2542874c8 (patch)
treedeef82a216f468fd57164f94700f2624164c7ca9 /tests/diagnostics/arrow-operator.slang
parentdd32414bd7332c55dc37ea2972ffcca73328d834 (diff)
Support arrow operator `->` on pointers. (#3812)
Diffstat (limited to 'tests/diagnostics/arrow-operator.slang')
-rw-r--r--tests/diagnostics/arrow-operator.slang25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/diagnostics/arrow-operator.slang b/tests/diagnostics/arrow-operator.slang
new file mode 100644
index 000000000..8c370cf67
--- /dev/null
+++ b/tests/diagnostics/arrow-operator.slang
@@ -0,0 +1,25 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly
+
+struct Type
+{
+ int member;
+}
+
+struct CB
+{
+ Type* ptr;
+}
+ConstantBuffer<CB> cb;
+
+[numthreads(1,1,1)]
+void main()
+{
+ Type val;
+
+ // CHECK: ([[# @LINE+1]]): error 30101
+ val->member = 2; // Error.
+
+ // CHECK-NOT: error
+ let a = cb->ptr->member; // OK.
+
+} \ No newline at end of file