<html>
<head>
<base href="http://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 --- - Members of current instantiation should be non-dependent, but are mostly treated as dependent"
href="http://llvm.org/bugs/show_bug.cgi?id=22038">22038</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Members of current instantiation should be non-dependent, but are mostly treated as dependent
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>harald@gigawatt.nl
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Consider this test program, which uses ADL to detect whether expressions are
treated as dependent or as non-dependent. Non-dependent expressions are looked
up at template definition time, so find the void f(const char *s, ...)
function. Dependent expressions are looked up at template instantiation time
with ADL, and find the void f(const char *s, S1) function.
#include <cstdio>
void f(const char *s, ...) { std::printf("%s: non-dependent\n", s); }
struct S1 { };
template <typename T>
struct S2 {
static S1 a;
static S1 b() { return {}; }
template <typename U>
static U c() { return {}; }
static void z() {
f("S1()", S1());
f("T()", T());
f("a", a);
f("b()", b());
f("c<T>()", c<T>());
f("c<S1>()", c<S1>());
f("decltype(b())()", decltype(b())());
}
};
void f(const char *s, S1) { std::printf("%s: dependent\n", s); }
int main() {
S2<S1>::z();
}
The output with r223387
(<a href="http://llvm.org/builds/downloads/LLVM-3.6.0-r223387-win32.exe">http://llvm.org/builds/downloads/LLVM-3.6.0-r223387-win32.exe</a> from 5 December)
is:
S1(): non-dependent
T(): dependent
a: non-dependent
b(): non-dependent
c<T>(): dependent
c<S1>(): dependent
decltype(b())(): dependent
Compilation flags used for testing: -std=c++11 -pedantic -Wall. No warnings or
errors are given.
The ones involving T are sanity checks: they're obviously dependent. All the
other ones should be non-dependent. The difference between b() and
decltype(b())() is particularly troubling to me: b() is treated as
non-dependent when used directly, and decltype(expr) is supposed to be
dependent if and only if expr is type-dependent, and T() is supposed to be
type-dependent if and only if T is dependent, yet decltype(b())() is treated as
dependent.</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>