[cmake-developers] build error in cmGeneratorExpressionEvaluator.cxx on SunOS CC

Bill Hoffman bill.hoffman at kitware.com
Wed Oct 10 17:02:11 EDT 2012

After this commit: http://open.cdash.org/viewUpdate.php?buildid=2598155
This build error has persisted:


line 484: Error: The name reportError(cmGeneratorExpressionContext*, 
const std::basic_string<char, std::char_traits<char>, 
std::allocator<char>>&, const std::basic_string<char, 
std::char_traits<char>, std::allocator<char>>&) is unusable in 
TargetFilesystemArtifact<0, 1, 1, 0>::Evaluate(const 
std::vector<std::basic_string<char, std::char_traits<char>, 
std::allocator<char>>, std::allocator<std::basic_string<char, 
std::char_traits<char>, std::allocator<char>>>>&, 
cmGeneratorExpressionContext*, const GeneratorExpressionContent*, 
cmGeneratorExpressionDAGChecker*) const.

A google shows this:


  The name is unusable in a default parameter

The name is unusable as a default parameter in the current context. 
Example of code that generates the error message:

void foo () {
     int a;

     class A {
             void goo (int b = a) {} // ERROR: a is unusable here

So, the compiler thinks that reportError can not be used in 
TargetFilesystemArtifact::Evaluate.   I am guessing the issue is that 
the template might be instatiated in a different scope than the current 
file, so the static reportError will not be available when that happens. 
    Perhaps a namespace for reportError or an inline instead of a static 
would work.

static void reportError(cmGeneratorExpressionContext *context,
                         const std::string &expr, const std::string &result)


inline void reportError(cmGeneratorExpressionContext *context,
                         const std::string &expr, const std::string &result)

Might fix it.


More information about the cmake-developers mailing list