繁体   English   中英

我不断从以前使用的工作代码中收到“错误:constexpr 变量'x'必须由常量表达式初始化”

[英]I keep getting an "error: constexpr variable 'x' must be initialized by a constant expression" from previously used working code

这几天我一直在挠头。 一步一步地删除和添加行并在每个阶段重新编译,直到它中断。

  ACTION act1( name nm, uint64_t ammount );
  ACTION act2(name nm, uint64_t signing_value);
  ACTION receiverand(name nm, checksum256& random_value);
  ACTION act4(name nm, uint64_t stake);
  ACTION act5(uint64_t num);
  ACTION act6(name nm);

  using act1_action = action_wrapper<"act1"_n, &project::act1>;
  using act2_action = action_wrapper<"act2"_n, &project::act2>;
  using receiverand_action = action_wrapper<"receiverand"_n, &project::receiverand>;
  using act4_action = action_wrapper<"act4"_n, &project::act4>;
  using act5_action = action_wrapper<"act5"_n, &project::act5>;
  using act6_action = action_wrapper<"act6"_n, &project::act6>;

当我添加act6时出现问题。 我必须采取行动4,一切正常。 所以我加了 5 和 6,然后抛出了错误,所以我又加了 5,一切都还好。 这是我不断收到的错误

 error: constexpr variable 'x' must be initialized by a constant expression
        constexpr auto x = 
        eosio::name{std::string_view{eosio::detail::to_const_char_arr<Str...>::value, 
        sizeof...(Str)}};

  note: in instantiation of function template specialization 'operator""_n<char, 'a', 
        'c', 't', '6'>' requested here
        using act6_action = action_wrapper<"act6"_n, &project::act6>;

 note: non-constexpr function 'check' cannot be used in a constant expression
       eosio::check( false, "character is not in allowed character set for names" );

似乎名称不能包含字符'6' ,而只能包含'1''5'

 Action names [...] May contain: az, 1-5, or.

https://eosio.stackexchange.com/questions/7/what-are-naming-rules-for-actions-tables-and-contracts

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM