Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Raffael_C_
Beginner
19 Views

Bug with decltype and scope operator

Hi,

I think I found a bug in the newest release of the Intel Compiler (Composer XE 2013 SP1 Update 1) on Windows; Namely the following code doesn't compile:

[cpp]

#include<vector>

void f()
{
std::vector<int> v;
decltype(v)::iterator i;
}

int main()
{
return 0;
}

[/cpp]

This code compiles succesfully with Visual C++, Clang 3.3 (on Linux) and gcc 4.8.2 (on linux).

Raffael

0 Kudos
1 Reply
Judith_W_Intel
Employee
19 Views

 

Yes this is something we just recently implemented in our development compiler.

This is the description of the change:

10/15/13
C++11: decltype allowed in nested-name-specifiers and destructor calls

The resolution of core issue 743, described in n3049, allowing decltype(expr)
to be used in a nested-name-specifier or following "~" in a destructor name is
now implemented.

  template <class T> struct A {
    struct B {};
  };
  template <class T> inline void f(T t) {
    typename decltype(t)::B b;
    T *p = new T();
    p->~decltype(t)();
  }
  int main() {
    A<int> a;
    f(a);
  }

Sorry for the inconvenience.

Judy