Hi @llvm, Am 08.03.2011 20:14, schrieb Jakob Stoklund Olesen:> Is that extra method getting called? What happens if you stick assert(0) in there?That won't work either (that is, the assert fires). In debug mode the MSVC lib tries to test the ordering of the sequence. And it uses the yielded predicate for this (which in this particular case is a very bad idea).> I hoped the symmetric methods would be enough to trick MSVC into compiling it.Does that mean, that gcc actually only needs bool operator()(const LiveRange&A, SlotIndex B) ? According to C++(2003) 25.0.0.8 the answer is "yes", however that section talks about BinaryPredicate and not Compare. The standard is rather unclear at this point and I'm going over to comp.std.c++ to ask. Best regards Olaf Krzikalla
On Mar 9, 2011, at 2:32 AM, Olaf Krzikalla <Olaf.Krzikalla at tu-dresden.de> wrote:> Hi @llvm, > > Am 08.03.2011 20:14, schrieb Jakob Stoklund Olesen: >> Is that extra method getting called? What happens if you stick assert(0) in there? > That won't work either (that is, the assert fires). In debug mode the MSVC lib tries to test the ordering of the sequence. And it uses the yielded predicate for this (which in this particular case is a very bad idea).I see. I guess that makes sense if it is written assuming symmetric types.> >> I hoped the symmetric methods would be enough to trick MSVC into compiling it. > Does that mean, that gcc actually only needs > > bool operator()(const LiveRange&A, SlotIndex B) ?Actually, the other way around.> According to C++(2003) 25.0.0.8 the answer is "yes", however that section talks about BinaryPredicate and not Compare. The standard is rather unclear at this point and I'm going over to comp.std.c++ to ask.Howard Hinnant was kind enough to clarify this a while back. http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-August/010379.html>
MSVC 9 asserts that the comparision function is symmetric, because of what was unclear wording in the standard (there are posts explaining this in the boost archive for those interested). The workaround is to supply the other overload of the comparator. Sorry Jacob, didn't reply all last time. On Wed, Mar 9, 2011 at 7:20 AM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:> On Mar 9, 2011, at 2:32 AM, Olaf Krzikalla <Olaf.Krzikalla at tu-dresden.de> wrote: > >> Hi @llvm, >> >> Am 08.03.2011 20:14, schrieb Jakob Stoklund Olesen: >>> Is that extra method getting called? What happens if you stick assert(0) in there? >> That won't work either (that is, the assert fires). In debug mode the MSVC lib tries to test the ordering of the sequence. And it uses the yielded predicate for this (which in this particular case is a very bad idea). > > I see. I guess that makes sense if it is written assuming symmetric types. > >> >>> I hoped the symmetric methods would be enough to trick MSVC into compiling it. >> Does that mean, that gcc actually only needs >> >> bool operator()(const LiveRange&A, SlotIndex B) ? > > Actually, the other way around. > >> According to C++(2003) 25.0.0.8 the answer is "yes", however that section talks about BinaryPredicate and not Compare. The standard is rather unclear at this point and I'm going over to comp.std.c++ to ask. > > Howard Hinnant was kind enough to clarify this a while back. > > http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-August/010379.html >> > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- Ahmed Charles http://www.ahmedcharles.com