<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - -Wno-error not honored when modules are enabled"
href="https://bugs.llvm.org/show_bug.cgi?id=51187">51187</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-Wno-error not honored when modules are enabled
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>Modules
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>lxfind@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=25059" name="attach_25059" title="Reproduce source files">attachment 25059</a> <a href="attachment.cgi?id=25059&action=edit" title="Reproduce source files">[details]</a></span>
Reproduce source files
When compiling with -fmodules, Clang seems to ignore the -Wno-error settings.
I attached a repro, if you run make on it, it will error out with:
In module 'module_a' imported from a.cpp:3:
./a.h:26:10: error: 'a<int>' is deprecated: THIS WILL WARN
[-Werror,-Wdeprecated-declarations]
return a(t);
^
a.cpp:6:10: note: in instantiation of function template specialization 'b<int>'
requested here
return b<int>(0) + c<int>(0);
^
./a.h:20:3: note: 'a<int>' has been explicitly marked deprecated here
[[deprecated("THIS WILL WARN")]] enable_if_t<true, T> a(T t) {
For reference, the content of the attachment is listed below as well:
*** a.h ***
template <bool B, class T = void>
struct enable_if {};
template <class T>
struct enable_if<true, T> {
typedef T type;
};
template <bool B, class T = void>
using enable_if_t = typename enable_if<B, T>::type;
template <typename T>
enable_if_t<false, T> a(T t) {
return t;
}
template <typename T>
[[deprecated("THIS WILL WARN")]] enable_if_t<true, T> a(T t) {
return t;
}
template <typename T>
T b(T t) {
return a(t);
}
template <typename T>
[[deprecated("THIS WON'T WARN")]] T c(T t) {
return t;
}
*** a.cpp ***
#include "a.h"
int main() {
return b<int>(0) + c<int>(0);
}
*** module.modulemap ***
module "module_a" {
explicit module "a.h" {
header "a.h"
export *
}
}
*** Makefile ***
CLANG=clang
fail:
${CLANG} -fmodules -Werror -Wdeprecated-declarations -Xclang
-emit-module -fmodule-name=module_a -x c++-header -I. module.modulemap
${CLANG} -Wno-error -Wno-error=deprecated-declarations
-Wno-deprecated-declarations -fmodules -fmodule-map-file=module.modulemap
-fmodule-file=module_a=module_a.pcm a.cpp
clean:
rm -f *.out *.pcm</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>