[Bug c++/83936] [feature request] Allow constexpr char* as target argument

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 19 08:40:00 GMT 2018


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> I doubt this can be implemented as attributes are handled in the
> preprocessing stage.
> 
> Kinda like allowing _Pargma to support constexpr would be weird too.

That is not true, attribute arguments are handled in the FEs, and C++ FE has
support for late attributes (those that have type or value dependent arguments
or certain fixed list of others).

The reason this is rejected is that the backends require as arguments of the
target attribute STRING_CSTs, string literals, which is not what they get in
this case, they get the target VAR_DECL with DECL_INITIAL of a NOP_EXPR with
ADDR_EXPR with the STRING_CST, and even when using fold_for_warn (which would
btw require the target attribute support to be moved to i386-c.c), that still
returns just the NOP_EXPR.  In short, even what the constexpr provides is not a
string literal but something else.


More information about the Gcc-bugs mailing list