HLSL: Handle greater/less depth modes. Fixes issue #489.
diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp
index e548e5d..6ddd1bf 100755
--- a/hlsl/hlslGrammar.cpp
+++ b/hlsl/hlslGrammar.cpp
@@ -302,10 +302,10 @@
     HlslToken idToken;
     while (acceptIdentifier(idToken)) {
         // function_parameters
-        TFunction* function = new TFunction(idToken.string, type);
-        if (acceptFunctionParameters(*function)) {
+        TFunction& function = *new TFunction(idToken.string, type);
+        if (acceptFunctionParameters(function)) {
             // post_decls
-            acceptPostDecls(type);
+            acceptPostDecls(function.getWritableType());
 
             // compound_statement (function body definition) or just a prototype?
             if (peekTokenClass(EHTokLeftBrace)) {
@@ -313,11 +313,11 @@
                     parseContext.error(idToken.loc, "function body can't be in a declarator list", "{", "");
                 if (typedefDecl)
                     parseContext.error(idToken.loc, "function body can't be in a typedef", "{", "");
-                return acceptFunctionDefinition(*function, node);
+                return acceptFunctionDefinition(function, node);
             } else {
                 if (typedefDecl)
                     parseContext.error(idToken.loc, "function typedefs not implemented", "{", "");
-                parseContext.handleFunctionDeclarator(idToken.loc, *function, true);
+                parseContext.handleFunctionDeclarator(idToken.loc, function, true);
             }
         } else {
             // a variable declaration