Bug 69836 - compilation error with constexpr in template types with redeclared methods
Summary: compilation error with constexpr in template types with redeclared methods
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 69837 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-02-16 12:57 UTC by Olivier Goffart
Modified: 2016-02-25 10:00 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
testcase (428 bytes, text/plain)
2016-02-16 12:57 UTC, Olivier Goffart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Goffart 2016-02-16 12:57:22 UTC
Created attachment 37701 [details]
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
Comment 1 Marek Polacek 2016-02-25 10:00:50 UTC
*** Bug 69837 has been marked as a duplicate of this bug. ***