From ff5e04f7f2e50466ed626193941c24b38494a785 Mon Sep 17 00:00:00 2001 From: Gangzheng Tong Date: Tue, 25 Mar 2025 19:47:01 -0700 Subject: 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 Ptr { 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 --- tests/language-feature/namespaces/simple-namespace.slang | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests/language-feature/namespaces') 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(); } -- cgit v1.2.3