setting symbol failed?

In my bigger project I have the following construct:

someHeader.h

#ifdef __CUDACC__

__constant__ int A;

__host__ inline void setA() {

  int val=1122;

  cudaMemcpyToSymbol(A, &val, sizeof(int), 0, cudaMemcpyHostToDevice);

}

#endif

someFile.cu

[...]

#include "someHeader.h"

[...]

__host__ inline void setA2() {

  int val=1122;

  cudaMemcpyToSymbol(A, &val, sizeof(int), 0, cudaMemcpyHostToDevice);

}

void init() {

  setA(); //(1)

  setA2(); //(2)

}

__global__ void doSomething() {

  [...]

}

[...]

Now, when I comment out line (2) and in doSomething() kernel I access value stored under A, I get 0.

When I comment out line (1) but keep (2) uncommented, a correct value of 1122 is got from A in the kernel.

I fail to reproduce this error in a simple case to give you a precise and small example. I must be missing something. Any ideas what could be the problem?

Thank you!

OK, I found a walkaround by replacing the inline function with a macro. But it is an ugly hack and I complely fail to understand in which possible scenario such a change can influence the program execution?