<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 - clang falsely(?) accepts c++17 code in c++14 mode?"
href="https://bugs.llvm.org/show_bug.cgi?id=37450">37450</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang falsely(?) accepts c++17 code in c++14 mode?
</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>enhancement
</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>lebedev.ri@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>This is creduce output, and it's not really easy to follow i'm afraid :/
<a href="https://godbolt.org/g/VMF1Ww">https://godbolt.org/g/VMF1Ww</a>
template <template <typename> class a> struct c {
template <typename> struct B { typedef a<int> d; };
};
template <template <typename> class e> struct f { typedef c<e> b; };
template <template <typename> class e> struct g { typedef f<e> d; };
template <class h> struct i {
static int j() {
typedef typename h::template B<int>::d k;
new k;
return 0;
}
};
template <typename l> struct m {
int j() {
(void)i<typename l::b>::j;
return 0;
}
};
template <typename> struct n {
static constexpr auto o = [] {};
};
bool p = &m<g<n>::d>::j;
Clang trunk accepts this without any warning with -Wall -Wextra -Werror
-std=c++14
gcc 8.1, with the same options, fails with
<source>: In instantiation of 'constexpr const n<int>::<lambda()> n<int>::o':
<source>:20:25: required from 'struct n<int>'
<source>:9:5: required from 'static int i<h>::j() [with h = c<n>]'
<source>:15:5: required from 'int m<l>::j() [with l = f<n>]'
<source>:22:23: required from here
<source>:20:25: error: the type 'const n<int>::<lambda()>' of 'constexpr'
variable 'n<int>::o' is not literal
static constexpr auto o = [] {};
^
<source>:20:25: note: 'n<int>::<lambda()>' is not literal because:
cc1plus: note: 'n<int>::<lambda()>' is a closure type, which is only literal
in C++17 and later
<source>:20:25: error: in-class initialization of static data member 'const
n<int>::<lambda()> n<int>::o' of non-literal type
Compiler returned: 1
Is this clang's or gcc's bug?</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>