Eclipse shows errors for aggregate/brace initialization since 201903-R version

Viewed 165

After updating to eclipse 2019-03-R or 2019-06-R eclipse shows errors for brace initializations.

e.g.

Invalid arguments for

std::string portStr{cfg.portStrInit};

Symbol 'counterStr' could not be resolved

    class Counter
    {
      private:
        std::string counterStr {};

      public:
        Counter(std::string _counterStr) : counterStr{_counterStr}
    }

Our Windriver compiler compiles that code and eclipse versions 2018-12-R and older do not complain.

Problem happens to complex types e.g. std::string, std::vector, own defined classes ...

Using simple types int, long etc. works for eclipse. e.g.

int test{cfg.testInit};

std:string{"Initializing with string and not with variable works for eclipse."};

For sure it might be better to initialize with () instead {} when passing variables for complex types. I am still surprised that our compiler does not complain about that kind of initialization.

    std::string portStr(cfg.portStrInit); accepted by eclipse instead of

    std::string portStr{cfg.portStrInit} not accepted by eclipse;

But it is grown code and we don't want to change hundreds of lines in order to satisfy eclipse.

Is there any possibility to make eclipse accepting this kind of initialization with {} for complex types?

0 Answers
Related