Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 __declspec(selectany) in wrong location

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
FitzyDog Posted - Aug 18 2010 : 9:37:10 PM
Just reporting a minor bug:

With this code:

template<class ComponentClassType>
struct unique_per_component
{
static Type component_type;
};

Right clicking on component_type and hitting "create implementation"
creates the following code..

__declspec(selectany) template<class ComponentClassType>
Type cmp::unique_per_component<ComponentClassType>::component_type;

This code does not compile(the selectany is in the wrong location). This is what is supposed to look like.

template<class ComponentClassType>
__declspec(selectany) Type cmp::unique_per_component<ComponentClassType>::component_type;
6   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Sep 24 2018 : 2:14:23 PM
case=115411 is fixed in build 2291.
feline Posted - Mar 28 2018 : 10:20:39 AM
Thank you for the clear example, and description, I am seeing the same problem here, now I know what to try and what to do, so I have put in a bug report for this:

case=115411
maorkh4 Posted - Mar 28 2018 : 08:49:59 AM
Hello!

The problem still persists as of 10.9.2258.5 built 2018.03.06 (VS 2015 Professional 14.0.25431.01 Update 3).

In order to reproduce the problem, please look at the following example:

template <typename ArithmeticType>
struct Yak
{
static_assert(std::is_arithmetic_v<ArithmeticType>, "Type must be arithmetic");

static ArithmeticType num;
};

Right clicking on num static member and and pressing "Create Implementation" will produce the following code:

__declspec(selectany) template <typename ArithmeticType>
ArithmeticType Yak<ArithmeticType>::num;

This code does not compile since the correct syntax is:

template <typename ArithmeticType> __declspec(selectany)
ArithmeticType Yak<ArithmeticType>::num;

Meaning __declspec(selectany) was put in the wrong location.

Notice that in accord's example there's no use of the template parameter in the static member declaration and that's why problem did not reproduce.
Please use my code here to reproduce the problem.

Thanks!
accord Posted - Jul 19 2012 : 11:46:24 PM
Sorry to hear this.
In order to be able to fix it, we will need to be able to reproduce the problem first here, internally. My previous post may shed a light on what is the missing link.
If you could piece together a small example source that can be compiled and used to reproduce the problem, it would be the best.
Unfortunately, problems do not always appear when the source is moved out of context. For example, into a new test project.
dgehri Posted - Jul 19 2012 : 08:02:13 AM
This still doesn't work as of version 10.7.1908.0 built 2012.05.31
accord Posted - Aug 19 2010 : 04:01:28 AM
Which version of Visual Assist are you using? I got different result with 1830. What is the definition of "Type"? It might be a factor.

I got this:

template<class ComponentClassType>
struct unique_per_component
{
	static int component_type;
};

template<class ComponentClassType>
int unique_per_component<ComponentClassType>::component_type;

and it compiles.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000