Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
34939067
Commit
34939067
authored
27 years ago
by
Benjamin Kosnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
From-SVN: r17129
parent
4f4da4e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
161 additions
and
0 deletions
+161
-0
gcc/testsuite/g++.old-deja/g++.benjamin/p13721.C
+21
-0
gcc/testsuite/g++.old-deja/g++.benjamin/tem01.C
+140
-0
No files found.
gcc/testsuite/g++.old-deja/g++.benjamin/p13721.C
0 → 100644
View file @
34939067
// Build don't link:
// prms-id: 13721
class
A
{
public
:
int
a
;
};
class
B
:
public
A
{
public
:
void
cmp
(
int
a
,
int
b
)
{}
B
(
int
a
=
0
)
{
cmp
(
A
::
a
,
a
);
//should not give warning
}
};
int
main
(
void
)
{
return
(
1
);
}
This diff is collapsed.
Click to expand it.
gcc/testsuite/g++.old-deja/g++.benjamin/tem01.C
0 → 100644
View file @
34939067
// Build don't link:
// prms-id: 13911
template
<
unsigned
int
N
>
class
ref_counter
{
public
:
ref_counter
()
:
p_refcnt
(
new
unsigned
int
(
N
))
{}
ref_counter
(
const
ref_counter
<
N
>&
x
)
:
p_refcnt
(
x
.
p_refcnt
)
{
++*
p_refcnt
;
}
ref_counter
&
operator
=
(
const
ref_counter
<
N
>&
rhs
)
{
++*
rhs
.
p_refcnt
;
decrement
();
p_refcnt
=
rhs
.
p_refcnt
;
return
*
this
;
}
~
ref_counter
()
{
decrement
();}
bool
unique
()
const
{
return
*
p_refcnt
==
N
;}
private
:
unsigned
int
*
p_refcnt
;
void
decrement
()
{
if
(
unique
())
delete
p_refcnt
;
else
--*
p_refcnt
;
}
};
template
<
class
T
,
unsigned
int
N
>
class
ref_pointer
{
public
:
ref_pointer
()
:
the_p
(
0
)
{}
ref_pointer
(
T
*
just_newed
)
:
the_p
(
just_newed
)
{}
virtual
~
ref_pointer
()
{
if
(
unique
())
delete
the_p
;}
protected
:
ref_pointer
::
ref_pointer
(
T
*
the_p_arg
,
ref_counter
<
N
>&
ref_count_arg
)
:
the_p
(
the_p_arg
),
ref_count
(
ref_count_arg
)
{}
public
:
ref_pointer
&
operator
=
(
const
ref_pointer
<
T
,
N
>&
);
ref_pointer
&
operator
=
(
T
*
);
operator
const
T
*
()
const
{
return
the_p
;}
T
*
operator
()()
{
return
the_p
;}
T
*
operator
()()
const
{
return
the_p
;}
T
&
operator
*
()
const
{
return
*
the_p
;}
friend
bool
operator
==
(
const
ref_pointer
<
T
,
N
>&
lhs
,
const
ref_pointer
<
T
,
N
>&
rhs
)
{
return
lhs
.
the_p
==
rhs
.
the_p
;
}
friend
bool
operator
!=
(
const
ref_pointer
<
T
,
N
>&
lhs
,
const
ref_pointer
<
T
,
N
>&
rhs
)
{
return
lhs
.
the_p
!=
rhs
.
the_p
;
}
bool
unique
()
const
{
return
ref_count
.
unique
();}
bool
isNull
()
const
{
return
the_p
==
0
;}
protected
:
ref_counter
<
N
>&
refCount
()
{
return
ref_count
;}
private
:
ref_counter
<
N
>
ref_count
;
T
*
the_p
;
};
template
<
class
T
,
unsigned
int
N
>
ref_pointer
<
T
,
N
>&
ref_pointer
<
T
,
N
>::
operator
=
(
const
ref_pointer
<
T
,
N
>&
rhs
)
{
if
(
the_p
!=
rhs
.
the_p
)
{
if
(
unique
())
delete
the_p
;
the_p
=
rhs
.
the_p
;
ref_count
=
rhs
.
ref_count
;
}
return
*
this
;
}
template
<
class
T
,
unsigned
int
N
>
ref_pointer
<
T
,
N
>&
ref_pointer
<
T
,
N
>::
operator
=
(
T
*
just_newed
)
{
if
(
unique
())
delete
the_p
;
the_p
=
just_newed
;
ref_count
=
ref_counter
<
N
>
();
return
*
this
;
}
template
<
class
T
>
class
CountedObjPtr
:
public
ref_pointer
<
T
,
1
>
{
public
:
CountedObjPtr
()
{}
CountedObjPtr
(
T
*
just_newed
)
:
ref_pointer
<
T
,
1
>
(
just_newed
)
{}
CountedObjPtr
(
T
*
the_p_arg
,
ref_counter
<
1
>&
ref_count_arg
)
:
ref_pointer
<
T
,
1
>
(
the_p_arg
,
ref_count_arg
)
{}
CountedObjPtr
<
T
>&
operator
=
(
T
*
rhs
)
{
ref_pointer
<
T
,
1
>::
operator
=
(
rhs
);
return
*
this
;
}
CountedObjPtr
<
T
>&
operator
=
(
const
CountedObjPtr
<
T
>&
rhs
)
{
ref_pointer
<
T
,
1
>::
operator
=
(
rhs
);
return
*
this
;
}
T
*
operator
->
()
const
{
return
(
*
this
)();}
};
//instantiating type
class
TSObservable
;
class
TSObserver
{
public
:
enum
TSType
{
NormalTS
,
UpYldCrvTS
,
DownYldCrvTS
,
ZeroVolTS
};
virtual
~
TSObserver
()
{}
virtual
void
update
(
TSObservable
*
theChangedObservable
)
=
0
;
virtual
TSType
key
()
const
{
return
myKey
;
}
virtual
TSType
&
key
()
{
return
myKey
;
}
protected
:
TSObserver
(
TSType
myKeyArg
)
:
myKey
(
myKeyArg
)
{}
TSType
myKey
;
};
//now try to instantiate
template
class
CountedObjPtr
<
TSObserver
>
;
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment