summaryrefslogtreecommitdiffstats
path: root/tests/language-feature
diff options
context:
space:
mode:
authorGangzheng Tong <tonggangzheng@gmail.com>2025-03-25 19:47:01 -0700
committerGitHub <noreply@github.com>2025-03-25 19:47:01 -0700
commitff5e04f7f2e50466ed626193941c24b38494a785 (patch)
tree710ba72842fed921f15cd11ed1379d927f2dcd4c /tests/language-feature
parent5339e46020c19653df6119b127e90e759bdda6b9 (diff)
Fix mul operator followed by global scope (#6686)
* Fix mul operator followed by global scope This should fix expr like `2.0f * ::a::b::c`. But it will no longer parse something like ``` extension<T> Ptr<T> { static void foo(); } int*::foo() // won't work, but this is a less common case ``` Fixes #6684 * Update simpe-namespace.slang to test global scope
Diffstat (limited to 'tests/language-feature')
-rw-r--r--tests/language-feature/namespaces/simple-namespace.slang7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/language-feature/namespaces/simple-namespace.slang b/tests/language-feature/namespaces/simple-namespace.slang
index 2066d2b7c..2bf2bb508 100644
--- a/tests/language-feature/namespaces/simple-namespace.slang
+++ b/tests/language-feature/namespaces/simple-namespace.slang
@@ -3,9 +3,11 @@
//TEST(compute):COMPARE_COMPUTE: -shaderobj
// Test that simple `namespace` declarations work as expected
+// Test that the global scope operator `::` works as expected
namespace A
{
+ static int num = 16;
struct X
{
int val;
@@ -47,7 +49,10 @@ namespace A
int test(int val)
{
A.X a = A::makeX(val);
- B::X b = B.makeX(val*16, val*256);
+ // Use the global scope operator "::A::num" to access the static member of namespace A
+ // Test it with mul operator
+ int num = 16*::A::num;
+ B::X b = B.makeX(val*16, val*num);
return a.getVal() + b.getHead() + b.getTail();
}