]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/fortran/doc/gfc-internals/type-bound-operators.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / fortran / doc / gfc-internals / type-bound-operators.rst
CommitLineData
c63539ff
ML
1..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6.. _type-bound-operators:
7
8Type-bound Operators
9********************
10
11Type-bound operators are in fact basically just ``GENERIC`` procedure
12bindings and are represented much in the same way as those (see
13:ref:`type-bound-procedures`).
14
15They come in two flavours:
16User-defined operators (like ``.MYOPERATOR.``)
17are stored in the ``f2k_derived`` namespace's ``tb_uop_root``
18symtree exactly like ordinary type-bound procedures are stored in
19``tb_sym_root`` ; their symtrees' names are the operator-names (e.g.
20:samp:`myoperator` in the example).
21Intrinsic operators on the other hand are stored in the namespace's
22array member ``tb_op`` indexed by the intrinsic operator's enum
23value. Those need not be packed into ``gfc_symtree`` structures and are
24only ``gfc_typebound_proc`` instances.
25
26When an operator call or assignment is found that cannot be handled in
27another way (i.e. neither matches an intrinsic nor interface operator
28definition) but that contains a derived-type expression, all type-bound
29operators defined on that derived-type are checked for a match with
30the operator call. If there's indeed a relevant definition, the
31operator call is replaced with an internally generated ``GENERIC``
32type-bound procedure call to the respective definition and that call is
3ed1b4ce 33further processed.