CINT unable to correctly match a function call that has an typedef to enum argument.

From: Nick West <n.west1_at_physics.ox.ac.uk>
Date: Thu, 5 Jun 2008 12:16:20 +0100


Dear Roottalk,

Using the latest ROOT (svn update last night) on

  Scientific Linux SL release 4.6 (Beryllium)   gcc version 3.4.6 20060404 (Red Hat 3.4.6-9)

I have a problem with CINT which is unable to correctly match a function call that has an typedef to enum argument.

If I define:-

  enum ESimFlag {kData = 0x01};
  void test_enum(ESimFlag mcflag) { std::cout << "enum works " << mcflag
<< std::endl; }

then I can subsequently use them:-

  ESimFlag enum_data = kData;
  test_enum(enum_data);

However, if I define a typedef:-

  typedef ESimFlag SimFlag_t;

and a new function:-

  void test_typedef(SimFlag_t mcflag) { std::cout << "typedef works "
<< mcflag << std::endl; }

then when I attempt to use them:-

  SimFlag_t typedef_data = kData;
  test_typedef(typedef_data);

CINT reports:-

  Error: Function test_typedef(typedef_data) is not defined in current scope

The attached macro demonstrates the problem. It works correctly if compiled:-

  root [0] .x test.C+

  enum works 1
  typedef works 1

but:-

  root [1] .x test.C
  enum works 1
  Error: Function test_typedef(typedef_data) is not defined in current scope test.C:15:

It also works in CINT with 5.18/00c but I am afraid I don't know at what point after that it stopped working although Rene explained that work is currently in progress on the migration to Reflex so it is possible that this is related to that migration.

Thanks,

Nick West

Received on Thu Jun 05 2008 - 13:16:25 CEST

This archive was generated by hypermail 2.2.0 : Thu Jun 05 2008 - 23:50:01 CEST