summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/parse/parse5.C
blob: f9e6a035984707d667d59515f9d5e0f082103bc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* PR c++/590 */
/* { dg-do compile } */

#include <iostream>
#include <sstream>
using namespace std;

enum ExternalEnum { EXTERNAL_VALUE = 2 };

class BadStream : public ostringstream 
{    
public: 
  enum InternalEnum { VALUE = 0 };   
  BadStream( InternalEnum e ) {}
  BadStream( InternalEnum e, int i ) {}
};

int main() 
{
  ( BadStream( BadStream::VALUE ) ) << "foobar" << endl;

  BadStream((BadStream::InternalEnum)BadStream::VALUE ) << "foobar";

  BadStream::InternalEnum in = BadStream::VALUE;
  BadStream( in ) << "foobar";
    
  BadStream( BadStream::VALUE, 0 ) << "foobar" << endl;
    
  // This didn't used to compile:
  BadStream( BadStream::VALUE ) << "foobar" << endl;

  return 0;
}