Parse Error addOperations

HI,
I created a an out-of-tree project named “custom” in the examples folder. The directory structure is same as of standalone.
The directory structure and files i added are :
MicrosoftTeams-image (1)

Built the project as :

mkdir build && cd build
cmake -G Ninja .. -DMLIR_DIR=$PREFIX/lib/cmake/mlir -DLLVM_EXTERNAL_LIT=$BUILD_DIR/bin/llvm-lit
cmake --build . 

The error is :

/home/sudip/Research/opensource/llvm-project/mlir/examples/custom/lib/Custom/CustomDialect.cpp: In member function ‘void mlir::custom::CustomDialect::initialize()’:
/home/sudip/Research/opensource/llvm-project/mlir/examples/custom/lib/Custom/CustomDialect.cpp:22:3: error: parse error in template argument list
   22 |   addOperations<
In file included from /home/sudip/Research/opensource/llvm-project/mlir/include/mlir/IR/MLIRContext.h:13,
                 from /home/sudip/Research/opensource/llvm-project/mlir/include/mlir/IR/DialectRegistry.h:16,
                 from /home/sudip/Research/opensource/llvm-project/mlir/include/mlir/IR/Dialect.h:16,
                 from /home/sudip/Research/opensource/llvm-project/mlir/examples/custom/include/Custom/CustomDialect.h:12,
                 from /home/sudip/Research/opensource/llvm-project/mlir/examples/custom/lib/Custom/CustomDialect.cpp:9:
/home/sudip/Research/opensource/llvm-project/mlir/include/mlir/Support/TypeID.h:264:18: error: expected ‘;’ before ‘{’ token
  264 |   namespace mlir {                                                             \
      |                  ^
/home/sudip/Research/opensource/llvm-project/mlir/examples/custom/build/include/Custom/CustomOpsDialect.cpp.inc:9:1: note: in expansion of macro ‘MLIR_DEFINE_EXPLICIT_TYPE_ID’
    9 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::custom::CustomDialec

The file “CustomDialect.cpp” is :

#include "Custom/CustomDialect.h"

#include "Custom/CustomOps.h"

​

using namespace mlir;

using namespace mlir::custom;

​

#include "Custom/CustomOpsDialect.cpp.inc"

​

//===----------------------------------------------------------------------===//

// Standalone dialect.

//===----------------------------------------------------------------------===//

​

void CustomDialect::initialize() {

addOperations<

#define GET_OP_LIST

#include "Custom/CustomOpsDialect.cpp.inc"

>();

}

Any idea on the same? created the same CMakeLists with required changes as per the dialect name.

This does not seem right, if you look at the standalone dialect as an example the two included files aren’t the same (line 16 and line 25): https://github.com/llvm/llvm-project/blob/main/mlir/examples/standalone/lib/Standalone/StandaloneDialect.cpp#L25

There is the version problem. Mine is older. Thank you for replying. I tried on the latest pull, there are changes and it worked.