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
1fb19247
Commit
1fb19247
authored
Nov 20, 2015
by
David Malcolm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add testcase erroneously omitted from r230638
From-SVN: r230675
parent
a87a86e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
0 deletions
+89
-0
gcc/testsuite/g++.dg/spellcheck-fields.C
+89
-0
No files found.
gcc/testsuite/g++.dg/spellcheck-fields.C
0 → 100644
View file @
1fb19247
/* { dg-do compile } */
struct
foo
{
int
foo
;
int
bar
;
int
baz
;
};
int
test
(
struct
foo
*
ptr
)
{
return
ptr
->
m_bar
;
/* { dg-error "'struct foo' has no member named 'm_bar'; did you mean 'bar'?" } */
}
int
test2
(
void
)
{
struct
foo
instance
=
{
0
,
0
,
0
};
return
instance
.
m_bar
;
/* { dg-error "'struct foo' has no member named 'm_bar'; did you mean 'bar'?" } */
}
struct
s
{
struct
j
{
int
aa
;
}
kk
;
int
ab
;
};
void
test3
(
struct
s
x
)
{
x
.
ac
;
/* { dg-error "'struct s' has no member named 'ac'; did you mean 'ab'?" } */
}
int
test4
(
struct
foo
*
ptr
)
{
return
sizeof
(
ptr
->
foa
);
/* { dg-error "'struct foo' has no member named 'foa'; did you mean 'foo'?" } */
}
/* Verify that we don't offer nonsensical suggestions. */
int
test5
(
struct
foo
*
ptr
)
{
return
ptr
->
this_is_unlike_any_of_the_fields
;
/* { dg-bogus "did you mean" } */
/* { dg-error "has no member named" "" { target *-*-* } 40 } */
}
union
u
{
int
color
;
int
shape
;
};
int
test6
(
union
u
*
ptr
)
{
return
ptr
->
colour
;
/* { dg-error "'union u' has no member named 'colour'; did you mean 'color'?" } */
}
struct
has_anon
{
struct
{
int
color
;
}
s
;
};
int
test7
(
struct
has_anon
*
ptr
)
{
return
ptr
->
s
.
colour
;
/* { dg-error "'struct has_anon::<anonymous>' has no member named 'colour'; did you mean 'color'?" } */
}
int
test8
(
foo
&
ref
)
{
return
ref
.
m_bar
;
/* { dg-error "'struct foo' has no member named 'm_bar'; did you mean 'bar'?" } */
}
struct
bar
:
public
foo
{
int
fizz
;
typedef
int
my_type
;
};
int
test9
(
bar
*
ptr
)
{
return
ptr
->
fuzz
;
/* { dg-error "'struct bar' has no member named 'fuzz'; did you mean 'fizz'?" } */
}
int
test10
(
bar
*
ptr
)
{
return
ptr
->
m_foo
;
/* { dg-error "'struct bar' has no member named 'm_foo'; did you mean 'foo'?" } */
}
int
test11
(
bar
*
ptr
)
{
return
ptr
->
mytype
;
/* { dg-error "'struct bar' has no member named 'mytype'; did you mean 'my_type'?" } */
}
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