This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/81000] New: std::any improvement


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81000

            Bug ID: 81000
           Summary: std::any improvement
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nicolas_daniengels at yahoo dot com.br
  Target Milestone: ---

The code:

    #if __has_include(<any>)
    #  include <any>
       using namespace std;
    #elif __has_include(<experimental/any>)
    #  include <experimental/any>
       using namespace std::experimental;
    #endif

    int f()
    {
        any a = 0.7777;
        a = 10;    
        return any_cast<int>(a);
    }

Is not optimised away (-O[1, 2, 3]) since was add in back 5.1. Could it be
improved for this trivial case?

Comparative:
https://godbolt.org/g/sfDj0C

Thanks to all contributors of libstdc++! 
Nicolas Engels

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]