tree string = cp_parser_constant_expression (parser);
if (string != error_mark_node)
string = cxx_constant_value (string, tf_error);
- if (TREE_CODE (string) == NOP_EXPR)
- string = TREE_OPERAND (string, 0);
- if (TREE_CODE (string) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (string, 0)) == STRING_CST)
- string = TREE_OPERAND (string, 0);
- if (TREE_CODE (string) == VIEW_CONVERT_EXPR)
- string = TREE_OPERAND (string, 0);
cexpr_str cstr (string);
if (!cstr.type_check (tok->location))
return error_mark_node;
When this feature is available the @code{__GXX_CONSTEXPR_ASM__} cpp symbol is defined.
@example
-constexpr const char *genfoo() @{ return "foo"; @}
+#include <string>
+constexpr std::string_view genfoo() @{ return "foo"; @}
void function()
@{
/* { dg-do compile } */
-/* { dg-options "-std=gnu++11" } */
+/* { dg-options "-std=gnu++17" } */
-constexpr const char *genfoo ()
+#include <string>
+
+constexpr std::string_view genfoo ()
{
return "foo %1,%0";
}
-constexpr const char *genoutput ()
+constexpr std::string_view genoutput ()
{
return "=r";
}
-constexpr const char *geninput ()
+constexpr std::string_view geninput ()
{
return "r";
}
-constexpr const char *genclobber ()
+constexpr std::string_view genclobber ()
{
return "memory";
}
/* { dg-do compile } */
-/* { dg-options "-std=gnu++11" } */
+/* { dg-options "-std=gnu++17" } */
-constexpr const char *genfoo ()
+#include <string>
+
+constexpr std::string_view genfoo ()
{
return "foo %1,%0";
}
-constexpr const char *genoutput ()
+constexpr std::string_view genoutput ()
{
return "=r";
}
-constexpr const char *geninput ()
+constexpr std::string_view geninput ()
{
return "r";
}
-constexpr const char *genclobber ()
+constexpr std::string_view genclobber ()
{
return "memory";
}