https://bugs.llvm.org/show_bug.cgi?id=37450
Bug ID: 37450
Summary: clang falsely(?) accepts c++17 code in c++14 mode?
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangb...@nondot.org
Reporter: lebedev...@gmail.com
CC: llvm-bugs@lists.llvm.org
This is creduce output, and it's not really easy to follow i'm afraid :/
https://godbolt.org/g/VMF1Ww
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?
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs