<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 --- - static_assert fails when applied to function parameter" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23776&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=Z4pjbdYKXp-SQAhxOWil4RR73I3kGwf2RkF8PNITT6Q&s=XTFb6Wj9Lakst9Fu1rqaG-6vIvplIYGKvYdbaftzbX8&e=">23776</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>static_assert fails when applied to function parameter
</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>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>C++14
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bremende55@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>#include <array>
void f(const std::array<char, 3> & m) {
static_assert(m.size() == 3, "error"); // does not compile!
}
int main() {
std::array<char, 3> arr;
static_assert(arr.size() == 3, "error"); // does compile
f(arr);
}
/*
The program compiles with g++ 5.1, but not with clang 3.7.
clang++ -v -std=c++14 clangtest.cpp yields:
clang version 3.7.0 (trunk 239219)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation:
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.2
Found candidate GCC installation:
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/5.1.0
Found candidate GCC installation:
/usr/local/lib64/gcc/x86_64-unknown-linux-gnu/4.9.2
Found candidate GCC installation:
/usr/local/lib64/gcc/x86_64-unknown-linux-gnu/5.1.0
Selected GCC installation: /usr/local/lib64/gcc/x86_64-unknown-linux-gnu/5.1.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
"/usr/local/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj
-mrelax-all -disable-free -main-file-name clangtest.cpp -mrelocation-model
static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-target-linker-version 13.2 -v -dwarf-column-info -resource-dir
/usr/local/bin/../lib/clang/3.7.0 -internal-isystem
/usr/local/lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0
-internal-isystem
/usr/local/lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/x86_64-unknown-linux-gnu
-internal-isystem
/usr/local/lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/bin/../lib/clang/3.7.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++14 -fdeprecated-macro
-fdebug-compilation-dir /home/me/basiccpp/divcpp -ferror-limit 19
-fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -o /tmp/clangtest-9f401f.o -x c++
clangtest.cpp
clang -cc1 version 3.7.0 based upon LLVM 3.7.0svn default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0
/usr/local/lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/x86_64-unknown-linux-gnu
/usr/local/lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/backward
/usr/local/include
/usr/local/bin/../lib/clang/3.7.0/include
/usr/include
End of search list.
clangtest.cpp:4:17: error: static_assert expression is not an integral constant
expression
static_assert(m.size() == 3, "error"); // does not compile
^~~~~~~~~~~~~
1 error generated.
*/</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>