[英]Is this partial class specialization buggy or is it a bug in clang or gcc?
template <class A>
struct Foo {
template <class Bar>
constexpr auto a_method();
};
template <class A>
template <class Bar>
constexpr auto Foo<A>::a_method() {
return 42;
}
template <>
template <class Bar>
constexpr auto Foo<void>::a_method() {
return 42;
}
GCC可以編譯這個。
但是 Clang不能。 錯誤 output:
<source>:15:27: error: conflicting types for 'a_method'
constexpr auto Foo<void>::a_method() {
^
<source>:4:18: note: previous declaration is here
constexpr auto a_method();
^
1 error generated.
Compiler returned: 1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.