OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [template/] [ctor4.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do compile }
2
 
3
// Copyright (C) 2001 Free Software Foundation, Inc.
4
// Contributed by Nathan Sidwell 24 Jun 2004 
5
 
6
// Origin Rani Sharoni via giovannibajo@libero.it
7
// Bug 16174, SFINAE failure.
8
 
9
template  struct K
10
{
11
  K();
12
 
13
  K(K & rhs);
14
  K(K const& rhs);
15
  template  K(K const& rhs);
16
 
17
private:
18
  template  struct A;
19
  template  struct A< K const>
20
  {  typedef typename K::compile_time_error type; };
21
 
22
  // This is used to reject calls to the copy constructor
23
  //  with objects which are top-level const. If they are
24
  //  const, the specialization of A is instantiated and
25
  //  causes a compile time error. Otherwise, the general
26
  //  template is picked up, it misses definition, so this
27
  //  ctor declaration is rejected by SFINAE and everybody
28
  //  is happy.
29
  // GCC 3.4.1pre and 3.5.0 always matches A's specialization
30
  //  when instantiating from foo(), and this causes the error.
31
  template 
32
  K(U& rhs, typename A::type = 0);
33
};
34
 
35
 
36
K foo(void)
37
{
38
  return K();
39
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.