https://github.com/shader-slang/slang
Raw File
Tip revision: d8a40abba5223fbcb56c52b04ccb88c02bbaf79f authored by Yong He on 22 March 2023, 04:29:13 UTC
[TreatAsDifferentiable] functions. (#2720)
Tip revision: d8a40ab
incomplete-member-decl.slang
// incomplete-member-decl.slang

//DIAGNOSTIC_TEST:SIMPLE:

// Regresion test to ensure parser doesn't go into infinite loop
// on incomplete/malformed member decalration

struct Outer
{
    // Programmer was *trying* to declarae a field, but somehow
    // ended up with two type specifiers.
    //
    // Parser sees the second (generic) type specifier and assumes
    // it must represent a method declaration, at which point it
    // fails to find a parameter list (no opening `(`), and then
    // fails to find a body (no opening `{`), but finds a bare identifier
    // instead.
    //
    int MyType<X> inner;
}
back to top