Skip to content

Commit

Permalink
Fix #2201: Improve const and copy constructor for TVarLivePair.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkslang committed Apr 30, 2020
1 parent 39281fb commit 97ee5c8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion glslang/MachineIndependent/iomapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,13 @@ typedef std::map<TString, TVarEntryInfo> TVarLiveMap;
// In the future, if the vc++ compiler can handle such a situation,
// this part of the code will be removed.
struct TVarLivePair : std::pair<const TString, TVarEntryInfo> {
TVarLivePair(std::pair<const TString, TVarEntryInfo>& _Right) : pair(_Right.first, _Right.second) {}
TVarLivePair(const std::pair<const TString, TVarEntryInfo>& _Right) : pair(_Right.first, _Right.second) {}
TVarLivePair& operator=(const TVarLivePair& _Right) {
const_cast<TString&>(first) = _Right.first;
second = _Right.second;
return (*this);
}
TVarLivePair(const TVarLivePair& src) { *this = src; }

This comment has been minimized.

Copy link
@pdaniell-nv

pdaniell-nv May 8, 2020

Contributor

This change has introduced a compilation error with gcc:

In file included from thirdparty/shaderc/third_party/glslang/glslang/MachineIndependent/iomapper.cpp:42:0:
thirdparty/shaderc/third_party/glslang/glslang/MachineIndependent/iomapper.h: In copy constructor 'glslang::TVarLivePair::TVarLivePair(const glslang::TVarLivePair&)':
thirdparty/shaderc/third_party/glslang/glslang/MachineIndependent/iomapper.h:247:5: error: base class 'struct std::pair<const std::__cxx11::basic_string<char, std::char_traits<char>, glslang::pool_allocator<char> >, glslang::TVarEntryInfo>' should be explicitly initialized in the copy constructor [-Werror=extra]
     TVarLivePair(const TVarLivePair& src) { *this = src; }
     ^~~~~~~~~~~~
cc1plus: all warnings being treated as errors
};
typedef std::vector<TVarLivePair> TVarLiveVector;

Expand Down

0 comments on commit 97ee5c8

Please sign in to comment.