KhronosGroup / KhronosGroup/glslang

glslang accepts function with void parameter and non-void parameter

Open
#2,094 4 comments 0 reactions 0 assignees View on GitHub
bug GLSL/ESSL
Dominant language
C++
Stars
3.6k
Forks
989
Avg merge
1d 2h
Merged PRs (30d)
31

Description

glslang accepts this shader:

```
#version 310 es

void bar(void) {

}

void foo(void, int x) { // Probably should not be allowed

}

void main() {
foo(5);
bar();
bar(void);
// rejected by glslang; good: foo(void, 5);
}
```

I think "void" in the context of parameters should only be allowed to represent an empty parameter list; I don't think it should accept an additional non-void parameter and ignore the void parameter.

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied shader through glslang and trace the parameter-list validation for declarations and calls involving void. Done means rejecting foo(void, int x) and foo(void, 5) while preserving the valid empty-list forms shown in the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.