This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77601] New: error: cannot convert 'is_same<int, Z>' to 'const bool' in initialization
- From: "lh_mouse at 126 dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 15 Sep 2016 16:07:48 +0000
- Subject: [Bug c++/77601] New: error: cannot convert 'is_same<int, Z>' to 'const bool' in initialization
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77601
Bug ID: 77601
Summary: error: cannot convert 'is_same<int, Z>' to 'const
bool' in initialization
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lh_mouse at 126 dot com
Target Milestone: ---
The following code chokes GCC:
template<typename T, typename U>
struct is_same {
constexpr operator bool() const noexcept {
return false;
}
};
template<typename T>
struct is_same<T, T> {
constexpr operator bool() const noexcept {
return true;
}
};
template<typename Z>
void foo(Z){
// This works with clang++ but does not with g++.
constexpr bool b1 = is_same<int, Z>{};
// This works with both.
constexpr bool b2 = is_same<int, Z>();
}
int main(){
foo(1);
// This works with both, too.
constexpr bool b3 = is_same<int, int>();
}