<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 --- - undefined-inline warning when constexpr is used"
href="http://llvm.org/bugs/show_bug.cgi?id=16329">16329</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>undefined-inline warning when constexpr is used
</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++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>steveire@gmail.com
</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>stephen@hal:/tmp$ clang++ --version
Ubuntu clang version 3.2-1~exp9ubuntu1 (tags/RELEASE_32/final) (based on LLVM
3.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
stephen@hal:/tmp$ clang++ -std=c++11 -DUSE_CONSTEXPR -c test.cpp
stephen@hal:/tmp$ clang++ -std=c++11 -c test.cpp
stephen@hal:/tmp$ ~/dev/build/qtbase/llvm/bin/clang++ --version
clang version 3.4
Target: x86_64-unknown-linux-gnu
Thread model: posix
stephen@hal:/tmp$ ~/dev/build/qtbase/llvm/bin/clang++ -std=c++11
-DUSE_CONSTEXPR -c test.cpp
test.cpp:9:20: warning: inline function 'typeId<A>' is not defined
[-Wundefined-inline]
DECL_CONSTEXPR int typeId();
^
test.cpp:19:15: note: used here
(void)typeId<A>();
^
1 warning generated.
stephen@hal:/tmp$ ~/dev/build/qtbase/llvm/bin/clang++ -std=c++11 -c test.cpp
stephen@hal:/tmp$ g++ --version
g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
stephen@hal:/tmp$ g++ -std=c++11 -DUSE_CONSTEXPR -c test.cpp
stephen@hal:/tmp$ g++ -std=c++11 -c test.cpp
stephen@hal:/tmp$ cat test.cpp
#ifdef USE_CONSTEXPR
#define DECL_CONSTEXPR constexpr
#else
#define DECL_CONSTEXPR
#endif
template <typename T>
DECL_CONSTEXPR int typeId();
struct A {};
template<typename T>
struct Template
{
static void registerType(T t)
{
t.does_not_compile;
(void)typeId<A>();
}
};
template <typename T>
DECL_CONSTEXPR int typeId()
{
return 0;
}
void avoidWarning()
{
// (void)typeId<A>();
}
The warning is not emitted if the contents of avoidWarning are uncommented.</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>