Bug with decltype and scope operator

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:

#include<vector>
void f()
{
std::vector<int> v;
decltype(v)::iterator i;
}
int main()
{
return 0;
}

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

Raffael

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

 

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

Leave a Comment

Please sign in to add a comment. Not a member? Join today