This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/16661] New: class-disambigued explicit c-tor call


$ cat >test.cxx
namespace n
{
  struct s
  {
    s (int i);
  };
  
  void
  s ();
  
  void
  f (struct s const&);
  
  struct s
  g ()
  {
    f (struct s (1));
    return struct s (1); 
  }
}

$ g++ --version
g++ (GCC) 3.4.1

$ g++ -c test.cxx
test.cxx: In function `n::s n::g()':
test.cxx:17: error: expected primary-expression before "struct"
test.cxx:18: error: expected primary-expression before "struct"
test.cxx:18: error: expected `;' before "struct"
test.cxx:18: error: expected primary-expression before "struct"
test.cxx:18: error: expected `;' before "struct"

Rewriting n::g () like this helps

struct s
g ()
{
  f ((struct s) (1));
  return (struct s) (1); 
}

Original example compiles fine with gcc 3.3.4.

-- 
           Summary: class-disambigued explicit c-tor call
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: boris at kolpackov dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-gnu-linux
  GCC host triplet: i686-pc-gnu-linux
GCC target triplet: i686-pc-gnu-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16661


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]