Too few template arguments in set

I had some code files that compiled fine either using a Makefile or using .L foo.C+, but then I tried moving a function from one of the top-level files into another file inside a namespace, and now I get this compilation error:

root [10] .L Utility.C+
Info in <ACLiC>: modified script has already been compiled and loaded
Info in <ACLiC>: it will be regenerated and reloaded!
Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/jfcaron/Projects/Proto2BeamTest2/./
In file included from /Users/jfcaron/Projects/Proto2BeamTest2/Utility_C_ACLiC_dict.cxx:17:
In file included from /Users/jfcaron/Projects/Proto2BeamTest2/Utility_C_ACLiC_dict.h:34:
/Users/jfcaron/Projects/Proto2BeamTest2/./Utility.C:295:23: error: too few template
      arguments for class template 'set'
    static const std::set<int> positives{14,15,16,17,66,67,90,91,117,118,
/Applications/ note: 
      template is declared here
    class _LIBCPP_TYPE_VIS_ONLY set;

The rest of the file Utility.C can be found here: with the function at the bottom.

The exact same function when placed in a bigger code file (but in global scope there, not in a namespace) compiles just fine. It also compiles on ideone here: What could be causing the problem? The error message seems completely meaningless to me. A class in Utility.C does use the ClassDef macro, could the macro be leaking out somehow and messing up my set?

Note: you need C++11 support to compile the code, since it uses initializer_list-construction for the set, auto and range-based for loops.


Hi Jean-Francois,

can you provide a minimal reproducer, i.e. not involving Geom.C etc?
Btw, I tried with an old version of your code and adding an #include was enough to compile.


I guess that’s what I get for trying to code late on a Friday afternoon. It was indeed a missing #include , but the error message wasn’t very useful for that!


Hi, I have the same problem how did you fixed it?

This was a long time ago, but I think I was just missing #include <set>.