From ad0411af494d15b0183183885230bafe721820b8 Mon Sep 17 00:00:00 2001
From: Daniel-Cortez <gromovstanislav@yandex.ru>
Date: Sun, 21 Jan 2024 13:43:14 +0700
Subject: [PATCH 1/2] declargs(): Check if `const` was already specified

---
 source/compiler/sc1.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source/compiler/sc1.c b/source/compiler/sc1.c
index ab319b46..9f0a6432 100644
--- a/source/compiler/sc1.c
+++ b/source/compiler/sc1.c
@@ -4276,6 +4276,8 @@ static int declargs(symbol *sym,int chkshadow)
         ident=iREFERENCE;
         break;
       case tCONST:
+        if (fconst)
+          error(42);                    /* invalid combination of class specifiers */
         if (ident!=iVARIABLE || numtags>0 || fpragma)
           error(1,sc_tokens[tSYMBOL-tFIRST],sc_tokens[tCONST-tFIRST]);
         fconst=TRUE;

From 8551e982eb45522b1a97b0dee479cb050908a517 Mon Sep 17 00:00:00 2001
From: Daniel-Cortez <gromovstanislav@yandex.ru>
Date: Sun, 21 Jan 2024 20:21:37 +0700
Subject: [PATCH 2/2] Add tests

---
 source/compiler/tests/gh_730_fix_const_arg.meta |  6 ++++++
 source/compiler/tests/gh_730_fix_const_arg.pwn  | 11 +++++++++++
 2 files changed, 17 insertions(+)
 create mode 100644 source/compiler/tests/gh_730_fix_const_arg.meta
 create mode 100644 source/compiler/tests/gh_730_fix_const_arg.pwn

diff --git a/source/compiler/tests/gh_730_fix_const_arg.meta b/source/compiler/tests/gh_730_fix_const_arg.meta
new file mode 100644
index 00000000..71e932a2
--- /dev/null
+++ b/source/compiler/tests/gh_730_fix_const_arg.meta
@@ -0,0 +1,6 @@
+{
+  'test_type': 'output_check',
+  'errors': """
+gh_730_fix_const_arg.pwn(1) : error 042: invalid combination of class specifiers
+  """
+}
diff --git a/source/compiler/tests/gh_730_fix_const_arg.pwn b/source/compiler/tests/gh_730_fix_const_arg.pwn
new file mode 100644
index 00000000..a999af88
--- /dev/null
+++ b/source/compiler/tests/gh_730_fix_const_arg.pwn
@@ -0,0 +1,11 @@
+Func1(const const a) return a; // error 042: invalid combination of class specifiers
+Func2(const a) return a;
+Func3(a) return a;
+
+main()
+{
+	Func1(0);
+	Func2(0);
+	Func3(0);
+}
+