Sunday 15 May 2011

c++ - clang 3.3 and GCC 4.7 const v's constexpr -


I just used a very large body of code using Clag 3.3 with GCC 4.7.3 standard library header files at Ubuntu 13.04 Tried to compile This all went well except for an issue. This code is already compiled with this standard Ubuntu clang 3.2 package on this machine, so I assume that there is some change in this Conak 3.3 Compiler. The problem related to const and constexpr using the complex headers is especially the following block of complex type of code

  #ifdef __GXX_EXPERIMENTAL_CXX0X__ // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std :: complex more-explained . Constexpr double (actual) {return __real__ _M_value; } Constexpr double image () {return __imag__ _M_value; } #sk double & amp; Real () {return __real__ _M_value; } Cut Double & amp; Real () const {returns __real__ _M_value; } Double & amp; Image () {return __imag__ _M_value; } Cut Double & amp; Imag () const {return __imag__ _M_value; } # Compile   

In my compilation, I enter the first block of code and therefore the compiler sees

  constexpr double real () {__real__ _M_value; }   

This causes the real spelling while generating an error which is

  / usr / lib / gcc / x86_64-linux-gnu / 4.7 /../../../../ included / C ++ / 4.7 / complex: 1212: 7: Note: The job of the candidate is not viable: In 'this' argument, 'cost complex' and 'double double' is; But the method is not marked const () {return __real__ _M_value; }   

I have read the following posts and some other similar documents but still it is not really clear whether this is a GCC header problem or a compile compiler problem. My feeling is that a member The function which has been named constexpr should be considered as a compiler, in which case the quarrel is wrong. According to False, partially implemented, this letter made a big difference to

. The following route has been removed.

For a non-static member job, a constexpr specifier, which is not a constructor, declares that the member is a work const (9.3.1).

This change means that your function can no longer be called on const objects. Apart from this, see what is the proposal to fix those areas of the library.

No comments:

Post a Comment