Menu

FP: wrong name resolution with enum class

2020-04-28
2021-01-28
  • Paul Cornett

    Paul Cornett - 2020-04-28
    struct S {
        enum class E { e1, e2 };
        E e;
        char* e1;
    };
    void f(S& s) {
        s.e = S::E::e1;
    }
    

    t.cpp:7:6: portability: Assigning a pointer to an integer is not portable. [AssignmentAddressToInteger]

     
  • CHR

    CHR - 2021-01-26

    I cannot reproduce this with v2.3.

     
  • Paul Cornett

    Paul Cornett - 2021-01-28

    Still happens with current main branch. Use --enable=all.

     
  • CHR

    CHR - 2021-01-28

    You are correct. The problem is related to enum class, enum alone does not give a warning.

     
  • CHR

    CHR - 2021-01-28
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.