<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 --- - -fms-compatibility should diagnose failed lookups in the presence of a dependent base"
href="http://llvm.org/bugs/show_bug.cgi?id=16014">16014</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-fms-compatibility should diagnose failed lookups in the presence of a dependent base
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>reid.kleckner@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=10513" name="attach_10513" title="minimal dependent base lookup failure test case">attachment 10513</a> <a href="attachment.cgi?id=10513&action=edit" title="minimal dependent base lookup failure test case">[details]</a></span>
minimal dependent base lookup failure test case
This is a variation on the old "unqualified lookup in dependent base" problem.
Normally clang errors out on code like the following, but in -fms-compatibility
mode, it fails to instantiate the method and actually makes it to codegen
without crashing or erroring out. Eventually I get a link error because nobody
else creates this instantiation.
$ cat min_etw.cc
template <int N> struct DepBase {
int header; // Commenting out gives the same result with -fms-compatibility.
};
template <int N> struct Depends : public DepBase<N> {
int *get() { return &header; } // header does not resolve
};
int *foo() {
Depends<5> event;
return event.get();
}
$ clang -cc1 -fms-extensions -triple i686-pc-linux min_etw.cc -emit-llvm -o
t.ll
min_etw.cc:4:25: error: use of undeclared identifier 'header'
void *get() { return &header; } // header does not resolve
^
1 error generated.
# This is correct, it's part of the FAQ:
# <a href="http://clang.llvm.org/compatibility.html#dep_lookup_bases">http://clang.llvm.org/compatibility.html#dep_lookup_bases</a>
$ clang -cc1 -fms-compatibility -triple i686-pc-linux min_etw.cc -emit-llvm -o
t.ll
# Exit code 0 and no diagnostic.
$ grep '_Z.*get' t.ll
%call = call i32* @_ZN7DependsILi5EE3getEv(%struct.Depends* %event)
declare i32* @_ZN7DependsILi5EE3getEv(%struct.Depends*) #1
# get is declared, not defined.</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>