diff --git a/numba/core/types/function_type.py b/numba/core/types/function_type.py
index 576a8cbd9..34a14e41d 100644
--- a/numba/core/types/function_type.py
+++ b/numba/core/types/function_type.py
@@ -4,7 +4,7 @@ __all__ = ['FunctionType', 'UndefinedFunctionType', 'FunctionPrototype',
 
 from abc import ABC, abstractmethod
 from .abstract import Type
-from .. import types
+from .. import types, errors
 
 
 class FunctionType(Type):
@@ -43,6 +43,17 @@ class FunctionType(Type):
     def get_call_type(self, context, args, kws):
         from numba.core import typing
 
+        if kws:
+            # First-class functions carry only the type signature
+            # information and function address value. So, it is not
+            # possible to determine the positional arguments
+            # corresponding to the keyword arguments in the call
+            # expression. For instance, the definition of the
+            # first-class function may not use the same argument names
+            # that the caller assumes. [numba/issues/5540].
+            raise errors.UnsupportedError(
+                f'first-class function call cannot use keyword arguments')
+
         if len(args) != self.nargs:
             raise ValueError(
                 f'mismatch of arguments number: {len(args)} vs {self.nargs}')

named parameters not recognized with first class functions
- [x ] I am using the latest ~~released~~ **master** version of Numba (most recent is visible in
 the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
- [x ] I have included below a minimal working reproducer (if you are unsure how
 to write one see http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports).


There is a problem recognizing named parameters. The following fails

```python
from numba import njit, types

@njit(types.int64(types.int64))
def foo(x):
    return x+1

@njit
def loop(foos):
    f = foos[0]
    return f(x=1)

loop((foo,))

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Internal error at <numba.core.typeinfer.CallConstraint object at 0x7f67f39a1a30>.
mismatch of arguments number: 0 vs 1
[1] During: resolving callee type: UndefinedFunctionType[undefined(undefined)20]
```

while this works

```python
@njit
def loop(foos):
    f = foos[0]
    return f(1)

loop((foo,))
```
diff --git a/numba/tests/test_function_type.py b/numba/tests/test_function_type.py
index a9739100a..e48590b18 100644
--- a/numba/tests/test_function_type.py
+++ b/numba/tests/test_function_type.py
@@ -1028,3 +1028,28 @@ class TestMiscIssues(TestCase):
             return bar_scalar(*formulae_foo)
 
         self.assertEqual(bar(), 30)
+
+    def test_issue_5540(self):
+
+        @njit(types.int64(types.int64))
+        def foo(x):
+            return x + 1
+
+        @njit
+        def bar_bad(foos):
+            f = foos[0]
+            return f(x=1)
+
+        @njit
+        def bar_good(foos):
+            f = foos[0]
+            return f(1)
+
+        self.assertEqual(bar_good((foo, )), 2)
+
+        with self.assertRaises(errors.TypingError) as cm:
+            bar_bad((foo, ))
+
+        self.assertRegex(
+            str(cm.exception),
+            r'.*first-class function call cannot use keyword arguments')

pip install -e .
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y gcc g++
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi @ file:///croot/certifi_1671487769961/work/certifi
exceptiongroup==1.2.2
importlib-metadata==6.7.0
iniconfig==2.0.0
llvmlite==0.32.1
-e git+https://github.com/numba/numba.git@ce2139c7dd93127efb04b35f28f4bebc7f44dfd5#egg=numba
numpy==1.21.6
packaging==24.0
pluggy==1.2.0
pytest==7.4.4
tomli==2.0.1
typing_extensions==4.7.1
zipp==3.15.0

name: numba
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - argparse==1.4.0
      - exceptiongroup==1.2.2
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - llvmlite==0.32.1
      - numpy==1.21.6
      - packaging==24.0
      - pluggy==1.2.0
      - pytest==7.4.4
      - tomli==2.0.1
      - typing-extensions==4.7.1
      - zipp==3.15.0
prefix: /opt/conda/envs/numba

numba/tests/test_function_type.py::TestMiscIssues::test_issue_5540
numba/tests/test_function_type.py::TestFunctionType::test_experimental_feature_warning numba/tests/test_function_type.py::TestFunctionType::test_in__ numba/tests/test_function_type.py::TestFunctionType::test_in_call__ numba/tests/test_function_type.py::TestFunctionType::test_in_call_out numba/tests/test_function_type.py::TestFunctionType::test_in_choose numba/tests/test_function_type.py::TestFunctionType::test_in_choose_func_value numba/tests/test_function_type.py::TestFunctionType::test_in_choose_out numba/tests/test_function_type.py::TestFunctionType::test_in_iter_func_call numba/tests/test_function_type.py::TestFunctionType::test_in_ns_seq_call numba/tests/test_function_type.py::TestFunctionType::test_in_overload numba/tests/test_function_type.py::TestFunctionType::test_in_pick_func_call numba/tests/test_function_type.py::TestFunctionType::test_in_seq_call numba/tests/test_function_type.py::TestFunctionType::test_ns_call numba/tests/test_function_type.py::TestFunctionType::test_ns_call_out numba/tests/test_function_type.py::TestFunctionType::test_ns_choose numba/tests/test_function_type.py::TestFunctionType::test_ns_out numba/tests/test_function_type.py::TestFunctionType::test_ns_overload numba/tests/test_function_type.py::TestFunctionTypeExtensions::test_compilation_results numba/tests/test_function_type.py::TestFunctionTypeExtensions::test_wrapper_address_protocol_libm numba/tests/test_function_type.py::TestMiscIssues::test_apply_function_in_function numba/tests/test_function_type.py::TestMiscIssues::test_constant_functions numba/tests/test_function_type.py::TestMiscIssues::test_function_with_none_argument numba/tests/test_function_type.py::TestMiscIssues::test_generators numba/tests/test_function_type.py::TestMiscIssues::test_issue_3405_using_cfunc numba/tests/test_function_type.py::TestMiscIssues::test_issue_3405_using_njit numba/tests/test_function_type.py::TestMiscIssues::test_issue_5470 numba/tests/test_function_type.py::TestMiscIssues::test_jit_support numba/tests/test_function_type.py::TestMiscIssues::test_pr4967_array numba/tests/test_function_type.py::TestMiscIssues::test_pr4967_example numba/tests/test_function_type.py::TestMiscIssues::test_reference_example numba/tests/test_function_type.py::TestMiscIssues::test_signature_mismatch numba/tests/test_function_type.py::TestMiscIssues::test_unique_dispatcher numba/tests/test_function_type.py::TestMiscIssues::test_zero_address
numba/core/types/function_type.py
numba/core/types/function_type.py