<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - cannot expand parameter pack of base classes outside the deriving class"
href="https://llvm.org/bugs/show_bug.cgi?id=27152">27152</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>cannot expand parameter pack of base classes outside the deriving class
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>amidvidy@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>See example code that compiles with gcc-5.3 but not clang++ 3.7
======================================
#include <iostream>
class Base1 {
public:
void foo() {
std::cout << "Base1" << std::endl;
}
};
class Base2 {
public:
void foo() {
std::cout << "Base2" << std::endl;
}
};
template <typename... Bases>
class Derived : public Bases... {
};
template<typename... Bases>
void call_foo_on_bases(Derived<Bases...> derived) {
using expander = int[];
(void) expander {0, (derived.Bases::foo(), 0)...};
}
int main() {
call_foo_on_bases(Derived<Base1, Base2>());
}
==============================
The compile fails with this error using clang++ 3.7 -
main.cpp:31:50: error: pack expansion does not contain any unexpanded parameter
packs
(void) expander {0, (derived.Bases::foo(), 0)...};
Interestingly, if we change the above code to expand the pack of base classes
within the derived class, it compiles correctly (.e.g.)
// WORKS!
template <typename... Bases>
class Derived : public Bases... {
public:
void call_foo_on_bases() {
using expander = int[];
(void) expander {0, (Bases::foo(), 0)... };
}
};</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>