https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69837
Bug ID: 69837 Summary: compilation error with constexpr in template types with redeclared methods Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ogoffart at kde dot org Target Milestone: --- Created attachment 37702 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37702&action=edit testcase The attached code [live: http://melpon.org/wandbox/permlink/wUtHZsr0ZAuiMtK1 ] Produce a compilation error with GCC while it is accepted by clang. file.cc:20:57: error: could not convert 'increment<2>((state((number<N>::prev<3>(), number<2>()), w_this), S<2>()))' from 'S<3>' to 'S<2>' RETURN(increment(state(w_counter.prev(), w_this))) ^ file.cc:11:43: note: in definition of macro 'RETURN' #define RETURN(R) -> decltype(R) { return R; } ^ Since decltype and the return value are both the same, this should not be a problem. It seems that gcc misunderstand the type of w_counter. Also in the error message there is "(number<N>::prev<3>(), number<2>())" why is there a commas there, and where does this <3> comes from? When the class (TemplateObject) is not a template, then the compilaiton passes