Skip to content

compilation order untrapped C++ compilation exception #114

@paciorek

Description

@paciorek

If one tries to compile a class that uses another class that is not yet compiled, we don't trap that and there is a C++ compiler error.

I haven't investigated as I don't know if this is something @perrydv already knows about. I'm happy to look into seeing how to catch this in our compilation processing.

nc1 <- nClass(
    Cpublic = list(
      Cfoo1 = nFunction(
        fun = function(x) {
          return(x)
        },
        argTypes = list(x = 'numericScalar'),
        returnType = 'numericScalar'
      )
    )
)

ncOuter <- nClass(
      Cpublic = list(
      CfooOuter = nFunction(
        fun = function(obj, x) {
          return(obj$Cfoo1(x)) 
        },
        argTypes = list(obj = 'nc1', x='numericScalar'),
        returnType = 'numericScalar'
      )
      )
)

cncOuter <- nCompile(ncOuter)
/accounts/vis/paciorek/R/x86_64-pc-linux-gnu-library-ubuntu-24.04/4.5/nCompiler/include/nCompiler/ET_ext/post_Rcpp/tensorOperations.h:1495:38:   required from ‘class nColPivHouseholderQR<Eigen::Map<Eigen::Matrix<double, -1, -1> > >’
/accounts/vis/paciorek/R/x86_64-pc-linux-gnu-library-ubuntu-24.04/4.5/nCompiler/include/nCompiler/ET_ext/post_Rcpp/tensorOperations.h:1593:20:   required from here
/system/linux/lib/R-24.04/4.5.0/x86_64/site-library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:56:30: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type’ {aka ‘__m128d’} [-Wignored-attributes]
In file included from /accounts/vis/paciorek/R/x86_64-pc-linux-gnu-library-ubuntu-24.04/4.5/nCompiler/include/nCompiler/ET_Rcpp_ext/ET_Rcpp_ext_post_Rcpp.h:7,
                 from /accounts/vis/paciorek/R/x86_64-pc-linux-gnu-library-ubuntu-24.04/4.5/nCompiler/include/nCompiler/nCompiler_omnibus.h:52:
/accounts/vis/paciorek/R/x86_64-pc-linux-gnu-library-ubuntu-24.04/4.5/nCompiler/include/nCompiler/ET_Rcpp_ext/post_Rcpp/ET_SEXP_converter.h: In function ‘int SEXP_2_int(SEXP, int, int)’:
/accounts/vis/paciorek/R/x86_64-pc-linux-gnu-library-ubuntu-24.04/4.5/nCompiler/include/nCompiler/ET_Rcpp_ext/post_Rcpp/ET_SEXP_converter.h:156:72: warning: unknown conversion type character ‘>’ in format [-Wformat=]
  156 |   if(LENGTH(Sn) <= i) PRINTF("Error: SEXP_2_int called for element %i% >= length of %i.\n", i, LENGTH(Sn));
      |                                                                        ^
nCompiler_units_1.cpp: In member function ‘double nClass_2::nFun_3(std::shared_ptr<nClass_1>, double)’:
nCompiler_units_1.cpp:25:15: error: expected unqualified-id before ‘(’ token
   25 | return((obj)->(x));
      |               ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions