[LLVMbugs] [Bug 23776] New: static_assert fails when applied to function parameter
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Jun 6 14:16:20 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23776
Bug ID: 23776
Summary: static_assert fails when applied to function parameter
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++14
Assignee: unassignedclangbugs at nondot.org
Reporter: bremende55 at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
#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.
*/
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150606/a398d744/attachment.html>
More information about the llvm-bugs
mailing list