# Structure constructor with procedure pointer component

**URL:** <https://fortran-lang.discourse.group/t/structure-constructor-with-procedure-pointer-component/2724>\
**Category:** Uncategorized\
**Created:** [February 4, 2022, 7:31am UTC](https://fortran-lang.discourse.group/t/structure-constructor-with-procedure-pointer-component/2724 "2022-02-04T07:31:10Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![sblionel](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/sblionel/32/853_2.png) [@sblionel](https://fortran-lang.discourse.group/u/sblionel)\
**Post date:** [February 4, 2022, 6:18pm UTC](https://fortran-lang.discourse.group/t/structure-constructor-with-procedure-pointer-component/2724/2 "2022-02-04T18:18:46Z")

</div>

It took me a while to work through what the standard says about this.

First, you have an array constructor as the initialization value for a named (PARAMETER) constant. The standard requires that this be a constant expression.

Next, we go to the rules for constant expressions (10.1.12). Here, an array constructor is fine as long as each element is a constant expression.

We’re still in 10.1.12, (3)(b) in this case, for structure constructors, where each pointer component “is an initialization target or a reference to the intrinsic function NULL,”.

So, what is an initialization target? For that we go to 8.2 where we see this:

> R805 _initialization_ is = _constant-expr_  
> or =\> _null-init_  
> or =\> _initial-data-target_

Oh, look. Initialization to a procedure target is not allowed! Therefore, you can’t have a procedure in a constant expression.

I seem to recall that there was some discussion earlier of allowing initialization of procedure pointers, but it didn’t make it in.

---

_[View the full topic](https://fortran-lang.discourse.group/t/structure-constructor-with-procedure-pointer-component/2724)._
