public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: mstevens@cra.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/3650: unnamed temporary gives: type specifier omitted for parameter
Date: Wed, 11 Jul 2001 08:56:00 -0000	[thread overview]
Message-ID: <20010711155332.12088.qmail@sourceware.cygnus.com> (raw)

>Number:         3650
>Category:       c++
>Synopsis:       unnamed temporary gives: type specifier omitted for parameter
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 11 08:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Mark R. Stevens
>Release:        /usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
>Organization:
>Environment:
rh linux 7.1
>Description:

Unnamed temporary type not being parsed correctly:

/usr/local/gcc-3.0/bin/g++ -Wall -o test Main.cpp
Main.cpp: In function `int main()':
Main.cpp:49: type specifier omitted for parameter
Main.cpp:50: type specifier omitted for parameter
Main.cpp:42: warning: unused variable `class2 c'
Main.cpp:43: warning: unused variable `class2 d'
Main.cpp:44: warning: unused variable `class2 e'
Main.cpp:45: warning: unused variable `class2 f'
Main.cpp:46: warning: unused variable `class2 g'
>How-To-Repeat:

#include <iostream>


//----------------------------------------------------------------------
class class1 {
public:
  explicit class1(double a) {
    data = a;
  }
  double data;
};
//----------------------------------------------------------------------

//----------------------------------------------------------------------
class class2 {
public:
  class2(class1 a, float t) {
    std::cout << "class2(" << a.data;
    std::cout << ", " << t << ")\n";
  }
  class2(float t, class1 a) {
    std::cout << "class2(" << a.data;
    std::cout << ", " << t << ")\n";
  }
};
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main() {

  double pir = 3.14159;
  class1 a(pir);
  class1 b(3.14159);

  std::cout << "Test 1 ";
  std::cout << a.data << ", ";
  std::cout << b.data << "\n";

  std::cout << "Test 2 ";
  float t2 = 1.5;
  class2 c(class1(3.14159), t2);
  class2 d(a, t2);
  class2 e(b, t2);
  class2 f(t2, class1(pir));
  class2 g(class1((double)pir), t2);

  // both should compile ????
  class2 h(class1(double(pir)), t2);
  class2 i(class1(pir), t2);

  return 0;
}
//----------------------------------------------------------------------
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="Main.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Main.cpp"

CiNpbmNsdWRlIDxpb3N0cmVhbT4KCgovLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KY2xhc3MgY2xhc3MxIHsKcHVi
bGljOgogIGV4cGxpY2l0IGNsYXNzMShkb3VibGUgYSkgewogICAgZGF0YSA9IGE7CiAgfQogIGRv
dWJsZSBkYXRhOwp9OwovLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KCi8vLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQpjbGFzcyBjbGFz
czIgewpwdWJsaWM6CiAgY2xhc3MyKGNsYXNzMSBhLCBmbG9hdCB0KSB7CiAgICBzdGQ6OmNvdXQg
PDwgImNsYXNzMigiIDw8IGEuZGF0YTsKICAgIHN0ZDo6Y291dCA8PCAiLCAiIDw8IHQgPDwgIilc
biI7CiAgfQogIGNsYXNzMihmbG9hdCB0LCBjbGFzczEgYSkgewogICAgc3RkOjpjb3V0IDw8ICJj
bGFzczIoIiA8PCBhLmRhdGE7CiAgICBzdGQ6OmNvdXQgPDwgIiwgIiA8PCB0IDw8ICIpXG4iOwog
IH0KfTsKLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tCgovLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KaW50IG1haW4oKSB7CgogIGRv
dWJsZSBwaXIgPSAzLjE0MTU5OwogIGNsYXNzMSBhKHBpcik7CiAgY2xhc3MxIGIoMy4xNDE1OSk7
CgogIHN0ZDo6Y291dCA8PCAiVGVzdCAxICI7CiAgc3RkOjpjb3V0IDw8IGEuZGF0YSA8PCAiLCAi
OwogIHN0ZDo6Y291dCA8PCBiLmRhdGEgPDwgIlxuIjsKCiAgc3RkOjpjb3V0IDw8ICJUZXN0IDIg
IjsKICBmbG9hdCB0MiA9IDEuNTsKICBjbGFzczIgYyhjbGFzczEoMy4xNDE1OSksIHQyKTsKICBj
bGFzczIgZChhLCB0Mik7CiAgY2xhc3MyIGUoYiwgdDIpOwogIGNsYXNzMiBmKHQyLCBjbGFzczEo
cGlyKSk7CiAgY2xhc3MyIGcoY2xhc3MxKChkb3VibGUpcGlyKSwgdDIpOwoKICAvLyBib3RoIHNo
b3VsZCBjb21waWxlID8/Pz8KICBjbGFzczIgaChjbGFzczEoZG91YmxlKHBpcikpLCB0Mik7CiAg
Y2xhc3MyIGkoY2xhc3MxKHBpciksIHQyKTsKCiAgcmV0dXJuIDA7Cn0KLy8tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
Cg==


             reply	other threads:[~2001-07-11  8:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-11  8:56 mstevens [this message]
2001-11-05  9:26 lerdsuwa
2001-11-05 11:26 lerdsuwa
2003-01-02 21:07 neil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010711155332.12088.qmail@sourceware.cygnus.com \
    --to=mstevens@cra.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).