mirror of
https://github.com/KhronosGroup/glslang
synced 2024-09-19 12:19:53 +00:00
parent
06a7078ce7
commit
9b67d41b85
37
Test/baseResults/struct.error.frag.out
Normal file
37
Test/baseResults/struct.error.frag.out
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
struct.error.frag
|
||||||
|
ERROR: 0:12: 'z' : no such field in structure
|
||||||
|
ERROR: 1 compilation errors. No code generated.
|
||||||
|
|
||||||
|
|
||||||
|
Shader version: 460
|
||||||
|
ERROR: node is still EOpNull!
|
||||||
|
0:7 Function Definition: test( ( global structure{ global float x})
|
||||||
|
0:7 Function Parameters:
|
||||||
|
0:8 Sequence
|
||||||
|
0:8 Branch: Return with expression
|
||||||
|
0:8 Constant:
|
||||||
|
0:8 1.000000
|
||||||
|
0:11 Function Definition: main( ( global void)
|
||||||
|
0:11 Function Parameters:
|
||||||
|
0:12 Sequence
|
||||||
|
0:12 Function Call: test( ( global structure{ global float x})
|
||||||
|
0:? Linker Objects
|
||||||
|
|
||||||
|
|
||||||
|
Linked fragment stage:
|
||||||
|
|
||||||
|
|
||||||
|
Shader version: 460
|
||||||
|
ERROR: node is still EOpNull!
|
||||||
|
0:7 Function Definition: test( ( global structure{ global float x})
|
||||||
|
0:7 Function Parameters:
|
||||||
|
0:8 Sequence
|
||||||
|
0:8 Branch: Return with expression
|
||||||
|
0:8 Constant:
|
||||||
|
0:8 1.000000
|
||||||
|
0:11 Function Definition: main( ( global void)
|
||||||
|
0:11 Function Parameters:
|
||||||
|
0:12 Sequence
|
||||||
|
0:12 Function Call: test( ( global structure{ global float x})
|
||||||
|
0:? Linker Objects
|
||||||
|
|
14
Test/struct.error.frag
Normal file
14
Test/struct.error.frag
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#version 460
|
||||||
|
|
||||||
|
struct A {
|
||||||
|
float x;
|
||||||
|
};
|
||||||
|
|
||||||
|
A test() {
|
||||||
|
return A(1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
test().z; // A.z does not exist, causes a crash
|
||||||
|
}
|
||||||
|
|
@ -1035,14 +1035,22 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
|
|||||||
inheritMemoryQualifiers(base->getQualifier(), result->getWritableType().getQualifier());
|
inheritMemoryQualifiers(base->getQualifier(), result->getWritableType().getQualifier());
|
||||||
} else {
|
} else {
|
||||||
auto baseSymbol = base;
|
auto baseSymbol = base;
|
||||||
while (baseSymbol->getAsSymbolNode() == nullptr)
|
while (baseSymbol->getAsSymbolNode() == nullptr) {
|
||||||
baseSymbol = baseSymbol->getAsBinaryNode()->getLeft();
|
auto binaryNode = baseSymbol->getAsBinaryNode();
|
||||||
TString structName;
|
if (binaryNode == nullptr) break;
|
||||||
structName.append("\'").append(baseSymbol->getAsSymbolNode()->getName().c_str()).append( "\'");
|
baseSymbol = binaryNode->getLeft();
|
||||||
error(loc, "no such field in structure", field.c_str(), structName.c_str());
|
}
|
||||||
|
if (baseSymbol->getAsSymbolNode() != nullptr) {
|
||||||
|
TString structName;
|
||||||
|
structName.append("\'").append(baseSymbol->getAsSymbolNode()->getName().c_str()).append("\'");
|
||||||
|
error(loc, "no such field in structure", field.c_str(), structName.c_str());
|
||||||
|
} else {
|
||||||
|
error(loc, "no such field in structure", field.c_str(), "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
error(loc, "does not apply to this type:", field.c_str(), base->getType().getCompleteString(intermediate.getEnhancedMsgs()).c_str());
|
error(loc, "does not apply to this type:", field.c_str(),
|
||||||
|
base->getType().getCompleteString(intermediate.getEnhancedMsgs()).c_str());
|
||||||
|
|
||||||
// Propagate noContraction up the dereference chain
|
// Propagate noContraction up the dereference chain
|
||||||
if (base->getQualifier().isNoContraction())
|
if (base->getQualifier().isNoContraction())
|
||||||
|
@ -211,6 +211,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||||||
"runtimeArray.vert",
|
"runtimeArray.vert",
|
||||||
"simpleFunctionCall.frag",
|
"simpleFunctionCall.frag",
|
||||||
"stringToDouble.vert",
|
"stringToDouble.vert",
|
||||||
|
"struct.error.frag",
|
||||||
"structAssignment.frag",
|
"structAssignment.frag",
|
||||||
"structDeref.frag",
|
"structDeref.frag",
|
||||||
"structure.frag",
|
"structure.frag",
|
||||||
|
Loading…
Reference in New Issue
Block a user