On 23 December 2011 09:06, Miles Bader <mi...@gnu.org> wrote:
> Is the following code valid?
>
>   #include <tuple>
>
>   struct X
>   {
>     std::tuple<int,int> tt{1, 2};   // works
>   };
>
>   struct Y
>   {
>     std::tuple<int,int> tt = std::tuple<int,int>{1, 2};   // *error*
>   };
>
> 'cause it results in an error with gcc 20111210:
>
>   $ g++-snapshot -c -std=c++11 nsdmi2.cc
>   nsdmi2.cc:10:43: error: expected unqualified-id before 'int'
>
>   $ g++-snapshot --version
>   g++ (Debian 20111210-1) 4.7.0 20111210 (experimental) [trunk revision 
> 182188]
>   Copyright (C) 2011 Free Software Foundation, Inc.
>   This is free software; see the source for copying conditions.  There is NO
>   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Yes, it's valid, please report it to bugzilla.

Here's a reduced form:

  template<typename T, typename U>
  struct tuple
  {
    tuple(T, U) { }
  };

  struct Y
  {
    tuple<int, int> tt = tuple<int, int>{1, 2};   // *error*
  };

Reply via email to