- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm currently working with Intel compiler under Windows (Version 13.1.3) and try to use alias templates as template template parameters. Essentially I would like to compile something like this:
[cpp]
#include <iostream>
using namespace std;
template<class A, class B>
struct Temp {
int foo() {
return 42;
}
};
template<class A>
using c_t = Temp<A,int>;
template<template<class> class TYPE>
struct Temp2 {
TYPE<int> a;
void foo() {
cout << a.foo() << endl;
}
};
int main()
{
Temp2<c_t> a;
a.foo();
return 0;
}
[/cpp]
This code compiles fine e.g. with GNU gcc 4.7.1. but the Intel compiler complains that the alias template c_t is not compatible with the template tempalte parameter TYPE. Is gcc here not restrictive enough or is it an actual bug in icl? A post on stackoverflow (http://stackoverflow.com/questions/7319567/can-i-use-template-aliases-as-template-template-parameters) seems to suggest the latter...
(I used the following command line arguments to compile: /Qstd=c++11 /Qlocation )
Best Regards,
Raffael
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried your test case on Windows with a later version of the compiler (13.1.*) and it compiles without errors, printing 42. Could you re-try after updating with the latest available?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Melanie and Sergey,
First of all thanks a lot for debugging the test case! The test case that I posted seems to compile indeed :)
I found out last week that I made a stupid mistake while compiling the test case with the Intel Compiler: In reality my problem is way more complex and spans over 4 different (Traits-) classes, so I've tried to reduce the problem to the above test case but I must have made an error while compiling it in order to get the error message, arrgh. I guess I was a bit confused because my real problem has indeed this error message.
I tried today for four hours to reduce my problem to a form which I could post here but it's almost impossible. So I've decided to circumvent the problem with another helper class that substitutes the alias template.
Thanks again for your efforts!
Raffael

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page