Make switch statements have their own nested scope (bug 11904).

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@25949 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2014-03-17 22:48:25 +00:00
parent c63759ef01
commit 71e01cbab9
4 changed files with 99 additions and 1 deletions

View File

@@ -118,4 +118,37 @@ void main()
case 5: // ERROR
default: // ERROR
switch (0) {
default:
int onlyInSwitch = 0;
}
onlyInSwitch; // ERROR
switch (0) {
default:
int x; // current "no statement" ERROR, but maybe this should count as a statement, or the semantic check removed
}
switch (c) {
case 1:
{
int nestedX;
break;
}
case 2:
nestedX; // ERROR
break;
case 3:
int linearZ;
break;
case 4:
int linearY = linearZ;
break;
case 5: // ERROR? that branch bypassed an initializer?
const int linearC = 4;
break;
case 6: // ERROR? that branch bypassed an initializer?
linearC;
}
}