Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Re: constexpr static member function (http://www.velocityreviews.com/forums/t958234-re-constexpr-static-member-function.html)

Victor Bazarov 03-01-2013 05:03 PM

Re: constexpr static member function
 
On 3/1/2013 11:19 AM, Juha Nieminen wrote:
> For some reason this doesn't compile with the latest clang:
>
> class MyClass
> {
> public:
> static constexpr int something(int);
> };
>
> constexpr int MyClass::something(int i) { return i+1; }
>
> The error message is "Conflicting types for 'something'".
>
> Is this a limitation in clang, in C++11, or am I using the wrong syntax?


Another thought, [dcl.constexpr]/2 states that "constexpr functions and
constexpr constructors are implicitly inline (7.1.2)." Perhaps you need
to define it inside the class...

V
--
I do not respond to top-posted replies, please don't ask

Victor Bazarov 03-02-2013 01:42 PM

Re: constexpr static member function
 
On 3/2/2013 4:09 AM, Juha Nieminen wrote:
> Victor Bazarov <v.bazarov@comcast.invalid> wrote:
>> Another thought, [dcl.constexpr]/2 states that "constexpr functions and
>> constexpr constructors are implicitly inline (7.1.2)." Perhaps you need
>> to define it inside the class...

>
> I would prefer knowledge over guessing.


Wouldn't we all?

> "Implicitly inline" means, as I understand it, "inline without having
> to explicitly specify that keyword."


As I understand it, a function cannot be explicitly or implicitly inline
if you don't provide its body.

V
--
I do not respond to top-posted replies, please don't ask


All times are GMT. The time now is 04:41 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.