Project

General

Profile

Bug #676

Compiling ci files that use "typename T" in argument list fails

Added by Nikhil Jain over 4 years ago. Updated over 1 year ago.

Status:
Merged
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
02/25/2015
Due date:
% Done:

10%


Description

Quoting Lawrence Kidder <> (reproduced by Nikhil)

I have Typename.C containing:

#include "Typename.decl.h" 

template <typename T>
class A : public CBase_A {
public:
  A() {}
  void help(const typename T::X& arg) {}
};

class B {};

class C { typedef B X; };

class Main : public CBase_Main {
public:
  Main(CkArgMsg* m) {}
};

#include "Typename.def.h" 

and Typename.ci containing:

mainmodule Typename {
  template <typename T>
  array [1D] A {
    entry A();
    entry void help(const typename T::X&);
  };

  array [1D] A<T>;

  mainchare Main {
    entry Main(CkArgMsg* m);
  };
};

The syntax error is caused by the keyword typename in the entry method A<T>::help

If I remove the keyword template, the interface file will compile, but of course Typename.C no longer compiles because the generated Charm++ methods fail with error: missing 'typename' prior to dependent type name 'T::X'

History

#1 Updated by Nikhil Jain over 4 years ago

My initial observation noted in a mail sent locally:

This may be a bug in the way we parse ci file. charmc seems to be throwing error when it sees two-word types of an entry method argument. Example "typename T".

I applied the usual macro trick to replace the two words by one, and with few other tweaks in Larry's code, I could get his code to compile. Will work with someone more knowledgeable on these things.

#2 Updated by Nikhil Jain over 4 years ago

  • % Done changed from 0 to 10
  • Status changed from New to In Progress

#3 Updated by Phil Miller about 4 years ago

  • Description updated (diff)

#4 Updated by Phil Miller about 4 years ago

Ralf, is fixing this as easy as changing the parser's definition of QualNamedType?

#5 Updated by Nikhil Jain over 3 years ago

  • Assignee changed from Nikhil Jain to PPL

#6 Updated by Phil Miller over 3 years ago

I think we can actually fix this the other direction - remove the need to ever say typename in the .ci file, and automatically insert it as needed in the generated output. I'll grab someone to work with me on this today.

#7 Updated by Phil Miller over 3 years ago

  • Assignee changed from PPL to Phil Miller

#8 Updated by Eric Bohm almost 3 years ago

Was this resolved?

#9 Updated by Phil Miller almost 3 years ago

No, it was not. Just worked around.

#10 Updated by Sam White over 2 years ago

  • Target version set to 6.9.0

#11 Updated by Phil Miller over 1 year ago

  • Assignee changed from Phil Miller to Evan Ramos

Reassign to Evan based on discussion with Eric B. Confer on how important this work is to schedule in the near future.

#12 Updated by Evan Ramos over 1 year ago

  • Status changed from In Progress to Implemented

#13 Updated by Evan Ramos over 1 year ago

  • Status changed from Implemented to In Progress

My WIP patch breaks the use of typename as a template parameter. Solving this is proving more difficult than expected.

#14 Updated by Evan Ramos over 1 year ago

  • Status changed from In Progress to Implemented

#15 Updated by Eric Mikida over 1 year ago

  • Status changed from Implemented to Merged

Also available in: Atom PDF