Giter VIP home page Giter VIP logo

Comments (5)

josyoun avatar josyoun commented on September 16, 2024

Quick question: Are you compiling develop or master? Short answer is that I believe this has been fixed on develop and I can port that to master. Long answer, this arises from a bug with alias templates in GCC that was resolved between GCC 4.8 and GCC 4.9 and above. Consider the program:

#include <iostream>
#include <typeinfo>
#include <cstdlib>

template <typename U,template <typename> class T>
struct foo{
    static void print() {
        std::cerr << "Undefined for type: "<< typeid(T <U>).name()
            << std::endl;
        exit(EXIT_FAILURE);
    }
};

// Create a dummy templated class
template <typename T>
struct bar {};

// Create a template alias based on this class
template <typename T> using bar_alias = bar <T>;

template <typename T>
struct foo <T,bar> {
    static void print() {
        std::cout << "This is bar" << std::endl;
    }
};

int main() {
    foo <double,bar>::print();
    foo <double,bar_alias>::print();
}

In GCC 4.9, this produces:

$ ./alias_template
This is bar
This is bar

In GCC 4.8 this produces:

$ ./alias_template
This is bar
Undefined for type: 3barIdE

Anyway, the result from GCC 4.9 and later is the correct result. Prior to my use of newer versions of GCC, I didn't know this was the case and I used an old work around that was incorrect, which I'm pretty sure is what the error above is. Technically, that code I attached is something slightly different, but I believe it to be a manifestation of the same bug.

I do have a fix and I can back port it into master. That being said, my preference would be to just fix up a couple of existing documentation issues and then do a new release, which would also fix things. In the immediate future:

  • You can compile without unit tests and it should work
  • Please verify this is on master and not develop

By the way, develop is now using C++14, so your CMake options will need to change slightly. In terms of when there's a new release, I do intend to do so soon. I could probably do that this week.

from optizelle.

Dapid avatar Dapid commented on September 16, 2024

I was compiling master, sorry I forgot to specify, and thank you for your detailed explanation. You know you are doing fancy stuff when you start hitting compiler bugs... Indeed, disabling the unit tests works on master.

On a side note: in both master and develop I had to manually set the C++ flavour flag, shouldn't they be there by default? I have the environment variable $CCFLAGS set to my architecture, and Cmake is picking it up, which is nice, but I wonder if it is overriding the setting.

I am not planning to use it in the immediate future, so I can wait for the new release. Also, I can test it in my boxes to make sure it runs smoothly before the release.

from optizelle.

josyoun avatar josyoun commented on September 16, 2024

Sounds great. I'm grinding through some code at the moment, but I'll send a message by in the next few days.

from optizelle.

josyoun avatar josyoun commented on September 16, 2024

Good call on the autodetect C++ versions. I updated the CMake scripts to auto set the C++14 compiler flags in commit 37bf35d. It looks like this came out with CMake 3.1 and I updated all of the required versions accordingly.

I'll wait to close this issue out when everything is pushed to master.

from optizelle.

josyoun avatar josyoun commented on September 16, 2024

I'm going to close this out since the issue was fixed and open a new ticket with the list of things I need to do before pushing everything to master. Mostly, I'm trying to stay organized.

from optizelle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.