Static const member variable defined multiple times - by Kaba_

Status : 

  Postponed<br /><br />
		Due to current priorities, the product team decided to postpone the resolution of this item.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


0
0
Sign in
to vote
ID 379496 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 11/2/2008 3:47:12 AM
Access Restriction Public

Description

test.h:

#ifndef TEST_H
#define TEST_H

class Test
{
public:
    static const int V = 2;
};

#endif

test.cpp:

#include "test.h"
const int Test::V;

main.cpp:

#include "test.h"

int main()
{
    return 0;
}
Sign in to post a comment.
Posted by Jonathan [MSFT] on 11/3/2008 at 7:46 AM
Hi: this is By-Design - experience showed that most users considered the declaration + initialization within the class to be a definition and hence they didn't understand why the needed (in some circumstances) to define the member outside of the class.

As you said the compiler handles this correctly with /Za.

Jonathan Caves
Visual C++ Compiler Team
Posted by Microsoft on 11/2/2008 at 10:24 PM
Thanks for your feedback.

We are escalating this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you,
Visual Studio Product Team