<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p><font face="Helvetica, Arial, sans-serif">I have the following
situation with which I could use some enlightenment. As usual,
the context is TableGen.<br>
</font></p>
<p><font face="Helvetica, Arial, sans-serif">in class Record:</font></p>
<blockquote>
<p><tt>public:<br>
using AssertionTuple = std::tuple<SMLoc, Init *, Init
*>;<br>
...<br>
SmallVector<AssertionTuple, 0> Assertions;</tt></p>
</blockquote>
<p>then there exists:</p>
<blockquote>
<p><tt> struct RecordsEntry {<br>
std::unique_ptr<Record> Rec;<br>
std::unique_ptr<ForeachLoop> Loop;<br>
std::unique_ptr<Record::AssertionTuple> Assertion;<br>
<br>
void dump() const;<br>
<br>
RecordsEntry() {}<br>
RecordsEntry(std::unique_ptr<Record> Rec) :
Rec(std::move(Rec)) {}<br>
RecordsEntry(std::unique_ptr<ForeachLoop> Loop)<br>
: Loop(std::move(Loop)) {}<br>
RecordsEntry(std::unique_ptr<Record::AssertionTuple>
Assertion) // 4th constructor<br>
: Assertion(std::move(Assertion)) {}<br>
};</tt></p>
<p><tt>...</tt></p>
<p><tt>bool TGParser::addEntry(RecordsEntry E) { ...<br>
</tt></p>
</blockquote>
<p>Note that I expect to create a RecordsEntry by passing an
AssertionTuple to addEntry and having the 4th constructor do the
trick. The other three constructors all work fine. However, when I
do this:</p>
<blockquote>
<p><tt> Record::AssertionTuple tuple =
std::make_tuple(ConditionLoc, Condition, Message);<br>
addEntry(std::move(tuple));<br>
</tt></p>
</blockquote>
<p>I get this:</p>
<blockquote>
<p><tt>C:\LLVM\llvm-project\llvm\lib\TableGen\TGParser.cpp(3190):
error C2664: 'bool
llvm::TGParser::addEntry(llvm::RecordsEntry)': cannot convert
argument 1 from 'llvm::Record::AssertionTuple' to
'llvm::RecordsEntry'<br>
C:\LLVM\llvm-project\llvm\lib\TableGen\TGParser.cpp(3190):
note: No user-defined-conversion operator available that can
perform this conversion, or the operator cannot be called<br>
C:\LLVM\llvm-project\llvm\lib\TableGen\TGParser.cpp(344):
note: see declaration of 'llvm::TGParser::addEntry'<br>
</tt></p>
</blockquote>
<p>Ah, I guess I should show the definitions of the three arguments
passed to make_tuple() above:</p>
<blockquote>
<p><tt> SMLoc ConditionLoc = Lex.getLoc();<br>
Init *Condition = ParseValue(CurRec);<br>
Init *Message = ParseValue(CurRec);</tt></p>
</blockquote>
<p> Since there is no complaint about making the tuple, I assume
those three arguments have the correct type. The problem is the
4th RecordsEntry constructor, which cannot convert the addEntry
argument 'std::move(tuple)' to a Record::AssertionTuple, even
though that's exactly what it is.</p>
<p>P.S.: Regardless of what I learn here, I'm going to change the
assertion tuple into a little struct, which should work fine as
demonstrated by constructor 3 above.<br>
</p>
<div class="moz-signature">
<font size="2"><br>
<!--Guga 'mzimba, sala 'nhliziyo-->
</font>
</div>
</body>
</html>