https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124177

Boris Staletic <boris.staletic at protonmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |boris.staletic at protonmail 
dot c
                   |                            |om

--- Comment #1 from Boris Staletic <boris.staletic at protonmail dot com> ---
The problem here is that `[[=f]]` treats `f` as a function, not as a function
pointer.

In case of reflect_constant, we do this:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/cp/reflect.cc;h=5d4cc16c67aa082bc0de9685f33471a2d453161e;hb=HEAD#l7394
There, fun is FUNC_DECL and type ends up being POINTER_TYPE.
Pointers are structural, so everything is fine.

In case of `[[=f]]`, in the annotation handler:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/cp/tree.cc;h=20288ed04eb0ad651701cb6d469776294ac8c482;hb=HEAD#l5917
args is a TREE_LIST, its value is a VIEW_CONVERT_EXPR and its type is
FUNCTION_TYPE. FUNCTION_TYPE is not considered structural, so we error.

That suggests a workaround:

```
void f();
[[=auto(f)]] void bar();
```

The above works, because `auto(f)` is a decay-copy.

I suppose handle_annotation_attribute should unconditionally decay
`TREE_VALUE(args)`, since the standard calls for such adjustment in
[temp.param]#15

Reply via email to