compiler error : get_if<> with a variant enum ?

Francine Sauvage francine.sauvage at atos.net
Mon Oct 17 19:17:02 AEDT 2022


I forgot some details:

Inventory::Item::server::FlexibleModule::ModuleTypes is an enum

Yaml file:
description: >
    Flexible Module Model
properties:
  - name: ModuleType
    default: Unknown
    type: enum[self.ModuleTypes]
    description: >
      Type of flexible module

enumerations:
   - name: ModuleTypes
     description: >
       The current type of a flexible module.
     values:
       - name: Unknown
         description: >
           flexible type is not known (starting?)
       - name: Switch
         description: >
           flexible module is a Switch
       - name: CPU
         description: >
           flexible module is CPU only
       - name: GPU
         description: >
           flexible module is CPU + GPU


Kind Regards,
[Atos logo]
Francine SAUVAGE
Team Leader - R&D, BDS
Atos France
Mobile: +33 6 21 43 11 21
R&D, BDS<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DP5g8tSWkCkU&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Ms2gu2PDvBD4Ogl0AhLpF1HllKl3s3kuv6Gw63nHDbc%3D&reserved=0>
Avenue Jean Jaurès - France
atos.net<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fatos.net%2F&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NEcchSNjDs2j1pcXCrru2MeIz5Uii38xg5HJEbPFQ2E%3D&reserved=0>
[LinkedIn icon]<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Ffrancine-sauvage-consultant%2F&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=7EnlnxDQG8AUgBlflxPI3uj9rUlQ6RfFTYAb3LtdzzE%3D&reserved=0> [Twitter icon] <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2Ffsauvage&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=zUWVIquoEIy%2FDH1HSFRPEBNDDTF29tvWkONSvtqkfXc%3D&reserved=0>  [Facebook icon] <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2FAtos%2F&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=L1LDaAUjf%2BpPOlU0K1rMHB5D%2FrvEomEgpM2Ghvpx4DY%3D&reserved=0>  [Youtube icon] <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fuser%2FAtos&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=18CHBR%2B1ap1a8%2Fv35you%2FGKiB0XoG4%2F6UU2cL%2F17CE8%3D&reserved=0>  [cid:image006.png at 01D8E211.973BA6E0] <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffrsauvage&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ur4%2Bou5o0JK2u6359ELCRwiSpG3ej%2BAW65DyqsC4NeE%3D&reserved=0> [cid:image007.png at 01D8E211.973BA6E0] <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fhub.docker.com%2Fu%2Ffrancine78&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=mRgv8%2FWZgU54cKGTQF9zARI9p%2BJOxESouwIGZpJCdS4%3D&reserved=0>
TT: [Wednesday or Thurday(2nd week of month) ] - Friday]
OoO : October 31


De : Francine Sauvage
Envoyé : lundi 17 octobre 2022 10:13
À : openbmc at lists.ozlabs.org
Objet : compiler error : get_if<> with a variant enum ?


Hi @all,

I would be pleased if you tell me how to compile a get_if<> with a sdbusplus enum variant ?

I was not able to figure out how to compile that :

const auto* flexible_module_type = std::get_if<sdbusplus::xyz::openbmc_project::Inventory::Item::server::FlexibleModule::ModuleTypes>(&flexible_prop_map_iterator->second);

** I tried to replace auto with sdbusplus::xyz::openbmc_project::Inventory::Item::server::FlexibleModule::ModuleTypes>
No success.

Error is :

bmcweb/1.0+git1.0-r0/recipe-sysroot/usr/include/c++/10.2.0/variant:1150:42: error: static assertion failed: T must occur exactly once in alternatives
static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,

I would be grateful for any help, even if you just tell me that this question should be asked elsewhere,

Thanks,

Kind Regards,
[Atos logo]
Francine SAUVAGE
Team Leader - R&D, BDS
Atos France
Mobile: +33 6 21 43 11 21
R&D, BDS<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DP5g8tSWkCkU&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Ms2gu2PDvBD4Ogl0AhLpF1HllKl3s3kuv6Gw63nHDbc%3D&reserved=0>
Avenue Jean Jaurès - France
atos.net<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fatos.net%2F&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NEcchSNjDs2j1pcXCrru2MeIz5Uii38xg5HJEbPFQ2E%3D&reserved=0>
[LinkedIn icon]<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Ffrancine-sauvage-consultant%2F&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=7EnlnxDQG8AUgBlflxPI3uj9rUlQ6RfFTYAb3LtdzzE%3D&reserved=0> [Twitter icon] <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2Ffsauvage&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=zUWVIquoEIy%2FDH1HSFRPEBNDDTF29tvWkONSvtqkfXc%3D&reserved=0>  [Facebook icon] <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2FAtos%2F&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=L1LDaAUjf%2BpPOlU0K1rMHB5D%2FrvEomEgpM2Ghvpx4DY%3D&reserved=0>  [Youtube icon] <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fuser%2FAtos&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=18CHBR%2B1ap1a8%2Fv35you%2FGKiB0XoG4%2F6UU2cL%2F17CE8%3D&reserved=0>  [cid:image006.png at 01D8E211.973BA6E0] <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffrsauvage&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ur4%2Bou5o0JK2u6359ELCRwiSpG3ej%2BAW65DyqsC4NeE%3D&reserved=0> [cid:image007.png at 01D8E211.973BA6E0] <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fhub.docker.com%2Fu%2Ffrancine78&data=05%7C01%7Cfrancine.sauvage%40atos.net%7C201b7a3a66ff416c998708daa60de5f6%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C638004875859707377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=mRgv8%2FWZgU54cKGTQF9zARI9p%2BJOxESouwIGZpJCdS4%3D&reserved=0>
TT: [Wednesday or Thurday(2nd week of month) ] - Friday]
OoO : October 31


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20221017/6b6985eb/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 3376 bytes
Desc: image001.png
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20221017/6b6985eb/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 663 bytes
Desc: image002.png
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20221017/6b6985eb/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 624 bytes
Desc: image003.png
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20221017/6b6985eb/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 530 bytes
Desc: image004.png
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20221017/6b6985eb/attachment-0010.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 623 bytes
Desc: image005.png
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20221017/6b6985eb/attachment-0011.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 600 bytes
Desc: image006.png
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20221017/6b6985eb/attachment-0012.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image007.png
Type: image/png
Size: 656 bytes
Desc: image007.png
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20221017/6b6985eb/attachment-0013.png>


More information about the openbmc mailing list