This is an archive of the discontinued LLVM Phabricator instance.

Move _PairT declaration out of __hash_combine to avoid warning under C++98
ClosedPublic

Authored by dim on Jan 9 2017, 10:59 AM.

Details

Summary

Some parts of the FreeBSD tree are still compiled with C++98, and until
rL288554 this has always worked fine. After that, a complaint about the
newly introduced local _PairT is produced:

/usr/include/c++/v1/memory:3354:27: error: template argument uses local type '_PairT' [-Werror,-Wlocal-type-template-args]
    typedef __scalar_hash<_PairT> _HashT;
                          ^~~~~~
/usr/include/c++/v1/memory:3284:29: error: template argument uses local type '_PairT' [-Werror,-Wlocal-type-template-args]
    : public unary_function<_Tp, size_t>
                            ^~~
/usr/include/c++/v1/memory:3356:12: note: in instantiation of template class 'std::__1::__scalar_hash<_PairT, 2>' requested here
    return _HashT()(__p);
           ^

As far as I can see, there should be no problem moving the _PairT
struct to just before the __hash_combine() function, which fixes this
particular warning.

Event Timeline

dim updated this revision to Diff 83654.Jan 9 2017, 10:59 AM
dim retitled this revision from to Move _PairT declaration out of __hash_combine to avoid warning under C++98.
dim updated this object.
dim added reviewers: EricWF, mclow.lists.
dim added subscribers: emaste, cfe-commits.
EricWF accepted this revision.Jan 9 2017, 12:15 PM
EricWF edited edge metadata.
This revision is now accepted and ready to land.Jan 9 2017, 12:15 PM
This revision was automatically updated to reflect the committed changes.