Opened 17 years ago
Closed 17 years ago
#194 closed defect (fixed)
graph_adaptor_test does not compile with VS2005/2008
| Reported by: | Alpar Juttner | Owned by: | Balazs Dezso | 
|---|---|---|---|
| Priority: | critical | Milestone: | LEMON 1.1 release | 
| Component: | core | Version: | hg main | 
| Keywords: | Cc: | ||
| Revision id: | b2564598b46d | 
Description (last modified by )
VS2005 reports various errors when compiling test/graph_adaptor_test.cc.
Attachments (1)
Change History (13)
comment:1 Changed 17 years ago by
| Description: | modified (diff) | 
|---|
comment:2 follow-up: 3 Changed 17 years ago by
comment:3 follow-up: 4 Changed 17 years ago by
comment:4 Changed 17 years ago by
Replying to alpar:
(And there are also a huge amount of warnings at the various part of LEMON. This is very annoying.)
The patch attached to #208 [94e3cf7b7fb4] solves the problem of warnings.
comment:5 Changed 17 years ago by
| Summary: | graph_adaptor_test does not compile with VS2005 → graph_adaptor_test does not compile with VS2005/2008 | 
|---|
The same problem exists with VS2008, too.
comment:6 follow-ups: 7 8 Changed 17 years ago by
I made a short example which shows the problem with visual c++.
#include <vector> #include <iostream>
template <typename T> struct X {};
template <typename T> struct A {
template <typename S> struct NA {};
};
template <class T> struct B : public A<T> {
template <typename S> struct NB : public X<typename A<T>::template NA<S> > {};
};
If the B did not inherited from the A<T> then the code would be compiled without error. In my opinion the VC++ interprets the template classes when the base classes are already known. I know only one unsafe workaround now.
#ifndef MSVC #define LEMON_FIX_VC(A,B) typename A::template B #else #define LEMON_FIX_VC(A,B) A::B #endif
struct NB : public X<LEMON_FIX_VC(A<T>, NA<S>)> {}; What is your opinion, should we use such workaround?
comment:7 Changed 17 years ago by
Replying to deba:
Let me just format you code snippets to make it easier to decode:
#include <vector>
#include <iostream>
template <typename T>
struct X {};
template <typename T>
struct A {
        template <typename S>
        struct NA {};
};
template <class T>
struct B : public A<T> {
        template <typename S>
        struct NB : public X<typename A<T>::template NA<S> > {};
};
and
#ifndef MSVC
#define LEMON_FIX_VC(A,B) typename A::template B
#else
#define LEMON_FIX_VC(A,B) A::B
#endif
struct NB : public X<LEMON_FIX_VC(A<T>, NA<S>)> {};
comment:8 Changed 17 years ago by
Replying to deba:
I know only one unsafe workaround now.
Why is it unsafe?
#define LEMON_FIX_VC(A,B) typename A::template B
Couldn't we find some more meaningful name for this define? E.g. LEMON_WRAP_INHERIT, or something like that.
What is your opinion, should we use such workaround?
Do we have any alternative options?
comment:9 follow-ups: 10 12 Changed 17 years ago by
I have uploaded [a85e7c0769d7], which makes a lot of renamings and some improvements in adaptors and edge sets. It also contains the fix wrong scope operator usage in visual c++. The solution is tested under g++ 4.3.2 - linux and MSVC 2008 - windows.
comment:10 follow-up: 11 Changed 17 years ago by
Replying to deba:
The solution is tested under g++ 4.3.2 - linux and MSVC 2008 - windows.
I've also successfully built it with Intel C++ versions 11.0 and 10.1.
Akos, could you test it with VS2005?
comment:11 Changed 17 years ago by
comment:12 Changed 17 years ago by
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
Replying to deba:
I have uploaded [a85e7c0769d7], which makes a lot of renamings and some improvements in adaptors and edge sets. It also contains the fix wrong scope operator usage in visual c++. The solution is tested under g++ 4.3.2 - linux and MSVC 2008 - windows.
The changeset (with changed commit log) is in the main-branch now, see [9b9ffe7d9b75].
Well done!



#67 contains various modifications related to the adaptors and their test file. This problem should be checked again after those changesets were applied.