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
3d7fcc04
Commit
3d7fcc04
authored
Aug 29, 1998
by
Benjamin Kosnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
�
more tests From-SVN: r22073
parent
4e327c30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
177 additions
and
0 deletions
+177
-0
gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C
+177
-0
No files found.
gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C
0 → 100644
View file @
3d7fcc04
// Build don't link:
// 980827 bkoz
// template parameter redeclaration bugs, part two:
// template template params and expanded template non-type parms
// 14.1 Template parameters
// p 13
// The scope of a template-parameter extens from its point of
// declartion until the end of its template. In particular, a
// template-parameter can be used in the declaration of subsequent
// template-parameters and their default arguments.
// 14.6.1 Locally declared names
// p 4
// A template-parameter shall not be redeclared within its scope
// (including nested scopes). A template-parameter shall not have the
// same name as the template name.
// 14
// declared friend template (v3, template type parameters)
template
<
class
T4
>
// ERROR - .*
class
Xfourteen
{
protected
:
T4
value
;
public
:
Xfourteen
(
T4
init
)
:
value
(
init
)
{}
template
<
template
<
typename
T4
>
class
T5
>
friend
bool
isequal
(
Xfourteen
<
int
>&
lhs
,
Xfourteen
<
int
>&
rhs
);
// ERROR - .*
};
// 15
// nested template class (v3, template type parameters)
template
<
class
T6
>
// ERROR - .*
class
Xfifteen
{
protected
:
T6
value
;
public
:
Xfifteen
(
T6
init
)
:
value
(
init
)
{}
template
<
template
<
typename
T6
>
class
T7
>
class
nested
{
// ERROR - .*
int
value
;
public
:
nested
()
:
value
(
int
(
0
))
{}
};
};
// 16
// member templates (v3, template type parameters)
template
<
class
T8
>
// ERROR - .*
class
Xsixteen
{
protected
:
T8
value
;
public
:
Xsixteen
(
T8
init
)
:
value
(
init
)
{}
template
<
template
<
typename
T8
>
class
T9
>
int
comp_ge
(
int
test
)
{
// ERROR - .*
int
local_value
;
if
(
local_value
>
value
)
return
local_value
;
else
return
value
;
}
};
// 17
// declared friend template (v4, template type parameters on the class)
template
<
typename
T9
>
class
tem_base
{
public
:
T9
value
;
};
template
<
typename
T10
,
template
<
typename
T12
>
class
C10
>
// ERROR - .*
class
Xseventeen
{
protected
:
C10
<
T10
>
value
;
public
:
Xseventeen
(){}
template
<
typename
T12
>
// ok??
friend
bool
isequal
(
Xseventeen
<
T10
,
tem_base
>&
lhs
,
Xseventeen
<
T10
,
tem_base
>&
rhs
);
};
//template class Xseventeen<int, tem_base>;
// 18
// more template template redecl tests
template
<
typename
T14
,
template
<
typename
T15
>
class
C12
>
// ERROR - .*
class
Xeighteen
{
protected
:
C12
<
T14
>
value
;
int
C12
;
// ERROR - .*
};
// 19
// more template template redecl tests
template
<
typename
T16
,
template
<
typename
T17
>
class
C14
>
// ERROR - .*
class
Xnineteen
{
protected
:
C14
<
T16
>
value
;
template
<
class
C14
>
class
nested
{
// ERROR - .*
T16
value
;
public
:
nested
()
:
value
(
T16
(
0
))
{}
};
};
// 20
// local names (14.6.1 p 4) part two, variable names as template param
template
<
class
T17
,
int
i
>
class
Xtwenty
{
void
f
(){
T17
my_type
;
//ok
for
(
int
j
=
0
;
j
<
5
;
++
l
)
{
T17
my_type
;
//ok
++
my_type
;
}
}
};
// 14.1 Template parameters
// p 4
// A non-type templat- parameter shall have one of the following
// (optionally cv-qualified) types:
// integral or enumeration type
// pointer to object or pointer to function
// referenct to object or referece to function
// pointer to member
// 21
// non-type template parameters v1: enum
enum
my_enum
{
my_A
=
45
,
my_B
,
my_C
};
template
<
my_enum
T18
>
class
Xtwentyone
{
// ERROR - .*
float
T18
;
// ERROR - .*
};
// 22
// non-type template parameters v1: pointer to object
struct
base
{
int
gcount
;
int
ret_gcount
()
{
return
gcount
;}
};
template
<
class
T20
,
base
*
b
>
class
Xtwentytwo
{
// ERROR - .*
float
b
;
// ERROR - .*
};
// 23
// non-type template parameters v2: reference to object
template
<
class
T20
,
base
&
b2
>
class
Xtwentythree
{
// ERROR - .*
float
b2
;
// ERROR - .*
};
// 24
// non-type template parameters v3: pointer to member
template
<
class
T20
,
int
base
::*
b3
>
class
Xtwentyfour
{
// ERROR - .*
float
b3
;
// ERROR - .*
};
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